1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-07-05 03:02:48 +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() flag.Parse()
if versionFlag { if versionFlag {
fmt.Println(version.FormatVersion()) fmt.Println("Mycorrhiza Wiki", version.FormatVersion())
os.Exit(0) os.Exit(0)
} }

View File

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