1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-04 18:19:54 +00:00

Use the generated version string on /about

This commit is contained in:
Umar Getagazov 2022-08-17 11:21:54 +03:00
parent 2c5b609319
commit f1342c0d75
3 changed files with 6 additions and 3 deletions

View File

@ -41,7 +41,7 @@ func parseCliArgs() {
flag.Parse()
if versionFlag {
fmt.Println(version.FormatVersion())
fmt.Println("Mycorrhiza Wiki", version.FormatVersion())
os.Exit(0)
}

View File

@ -4,6 +4,7 @@ import (
"github.com/bouncepaw/mycorrhiza/cfg"
"github.com/bouncepaw/mycorrhiza/l18n"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/version"
"log"
"strings"
"text/template" // sic!
@ -36,7 +37,7 @@ const aboutTemplateString = `
<h1>{{ printf (get .L.Title) .Cfg.WikiName }}</h1>
<dl>
<dt>{{ get .L.Version }}</dt>
<dd>1.11.0</dd>
<dd>{{ .Version }}</dd>
{{ if .Cfg.UseAuth }}
<dt>{{ get .L.HomeHypha }}</dt>
<dd><a href="/">{{ .Cfg.HomeHypha }}</a></dd>
@ -67,6 +68,7 @@ const aboutTemplateString = `
var aboutData = struct {
L map[string]L10nEntry
Version string
Cfg map[string]interface{}
Admins []string
UserCount uint64
@ -96,6 +98,7 @@ func AboutHTML(lc *l18n.Localizer) string {
log.Fatalln(err)
}
data := aboutData
data.Version = version.FormatVersion()
data.Admins = user.ListUsersWithGroup("admin")
data.UserCount = user.Count()
data.RegistrationLimit = cfg.RegistrationLimit

View File

@ -28,5 +28,5 @@ func FormatVersion() string {
}
}
return fmt.Sprintf("Mycorrhiza Wiki %s+%s%s", taggedRelease, commitHash[:7], dirty)
return fmt.Sprintf("%s+%s%s", taggedRelease, commitHash[:7], dirty)
}