panel: show the running version in the layout footer
Nothing in the UI said which build was running, though it is the value a backup manifest is compared against on restore and the first thing worth knowing when the panel misbehaves — it was only in the startup log line and `panel -version`. Add it as a small footer in the shared layout, supplied from render() alongside .Active so no handler has to pass it, and gated on .User: the login and setup pages face the internet and should not advertise a version. Tests cover both the footer and render() supplying the key, since neither is visible from any single handler. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,10 +79,13 @@ func (s *Server) render(w http.ResponseWriter, status int, page string, data any
|
||||
// The layout's navigation compares .Active against each item, so the key
|
||||
// must exist on every authenticated page. Defaulting it here keeps a page
|
||||
// that forgets it from failing to render — it simply highlights nothing.
|
||||
// .Version, shown in the layout's footer, is supplied the same way: it is
|
||||
// the same value on every page, so no handler should have to pass it.
|
||||
if m, ok := data.(map[string]any); ok {
|
||||
if _, has := m["Active"]; !has {
|
||||
m["Active"] = ""
|
||||
}
|
||||
m["Version"] = s.cfg.Version
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
if err := tmpl.ExecuteTemplate(&buf, "layout.html", data); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user