fix: version display in admin header
This commit is contained in:
parent
2a255b55ec
commit
7b797f0785
1 changed files with 10 additions and 1 deletions
11
main.go
11
main.go
|
|
@ -397,6 +397,7 @@ func adminHandler(w http.ResponseWriter, r *http.Request) {
|
|||
"CaddyUp": caddyUp,
|
||||
"LauncherUp": launcherUp,
|
||||
"Lang": userLang,
|
||||
"Version": appVersion,
|
||||
})
|
||||
|
||||
case http.MethodPost:
|
||||
|
|
@ -742,6 +743,7 @@ var (
|
|||
funcMap template.FuncMap
|
||||
)
|
||||
var adminTmpl *template.Template
|
||||
var appVersion = "dev"
|
||||
|
||||
func loadTranslations(lngDir string) {
|
||||
langs := []string{"en", "de"}
|
||||
|
|
@ -1328,7 +1330,7 @@ const adminHTML = `<!DOCTYPE html>
|
|||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>NextWorkspace · Admin</h1>
|
||||
<h1>NextWorkspace · Admin <span style="font-size:0.7rem;color:#718096;font-weight:400;">v{{.Version}}</span></h1>
|
||||
<div class="top-nav">
|
||||
<a href="/home/">Launcher</a>
|
||||
<a href="https://auth.nextwks.eu/logout" style="color:#fc8181;">Logout</a>
|
||||
|
|
@ -1579,6 +1581,13 @@ func main() {
|
|||
companyName = settings.Company.Name
|
||||
}
|
||||
|
||||
// Load version
|
||||
versionBytes, _ := os.ReadFile("/opt/nextworkspace/VERSION")
|
||||
v := strings.TrimSpace(string(versionBytes))
|
||||
if v != "" {
|
||||
appVersion = v
|
||||
}
|
||||
|
||||
// Load translations from lng/ directory
|
||||
loadTranslations("/opt/nextworkspace/lng")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue