From 6bcbaa1574b7538f5df364dad1d759fb1e5d2f13 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Fri, 20 Feb 2026 19:39:52 +0100 Subject: [PATCH] hub v0.3.2: Show Hub version in page footers Add hubVersion template function via closure in web.New(). Version is passed from main.go (set via ldflags at build time) and displayed in the footer of all 6 page templates. Co-Authored-By: Claude Opus 4.6 --- hub/CHANGELOG.md | 7 +++++++ hub/README.md | 2 +- hub/cmd/hub/main.go | 2 +- hub/internal/web/server.go | 7 +++++-- hub/internal/web/templates/config_detail.html | 2 +- hub/internal/web/templates/config_form.html | 2 +- hub/internal/web/templates/configs.html | 2 +- hub/internal/web/templates/customer.html | 2 +- hub/internal/web/templates/customer_unified.html | 2 +- hub/internal/web/templates/dashboard.html | 2 +- 10 files changed, 20 insertions(+), 10 deletions(-) diff --git a/hub/CHANGELOG.md b/hub/CHANGELOG.md index ddc6844..3b89bab 100644 --- a/hub/CHANGELOG.md +++ b/hub/CHANGELOG.md @@ -1,5 +1,12 @@ # Felhom Hub — Changelog +## v0.3.2 (2026-02-20) + +**Hub Version Display** + +- Show Hub version in footer of all pages via `hubVersion` template function. +- `web.New()` now accepts `version` parameter (4th arg) — set via ldflags at build time. + ## v0.3.1 (2026-02-20) **Config Diff Display + Pull Config** diff --git a/hub/README.md b/hub/README.md index 006cbfd..b722439 100644 --- a/hub/README.md +++ b/hub/README.md @@ -4,7 +4,7 @@ A lightweight Go service that receives periodic reports and structured events from felhom-controller instances, stores them in SQLite, and provides a web dashboard for fleet monitoring. Also serves as the infrastructure backup store for disaster recovery, event-based dead man's switch monitoring, and notification dispatch. -**Current version: v0.3.1** +**Current version: v0.3.2** --- diff --git a/hub/cmd/hub/main.go b/hub/cmd/hub/main.go index 3684383..87c3c1e 100644 --- a/hub/cmd/hub/main.go +++ b/hub/cmd/hub/main.go @@ -135,7 +135,7 @@ func main() { ) apiHandler.SetDispatcher(dispatcher) - webServer := web.New(dataStore, cfg.Auth.PasswordHash, cfg.API.ReportAPIKey, staleThreshold, logger) + webServer := web.New(dataStore, cfg.Auth.PasswordHash, cfg.API.ReportAPIKey, Version, staleThreshold, logger) webServer.SetTemplateFetcher(templateFetcher) // Build HTTP mux diff --git a/hub/internal/web/server.go b/hub/internal/web/server.go index 62692a5..4e8cca8 100644 --- a/hub/internal/web/server.go +++ b/hub/internal/web/server.go @@ -21,6 +21,7 @@ type Server struct { store *store.Store passwordHash string apiKey string // report API key — used for controller callbacks + version string logger *log.Logger templates *template.Template staleThreshold time.Duration @@ -29,7 +30,7 @@ type Server struct { } // New creates a new web server. -func New(store *store.Store, passwordHash, apiKey string, staleThreshold time.Duration, logger *log.Logger) *Server { +func New(store *store.Store, passwordHash, apiKey, version string, staleThreshold time.Duration, logger *log.Logger) *Server { funcMap := template.FuncMap{ "timeAgo": timeAgo, "statusColor": statusColor, @@ -40,7 +41,8 @@ func New(store *store.Store, passwordHash, apiKey string, staleThreshold time.Du b, _ := json.Marshal(v) return template.JS(b) }, - "add": func(a, b int) int { return a + b }, + "hubVersion": func() string { return version }, + "add": func(a, b int) int { return a + b }, "mapGet": func(m map[string]int, key string) int { if m == nil { return 0 @@ -55,6 +57,7 @@ func New(store *store.Store, passwordHash, apiKey string, staleThreshold time.Du store: store, passwordHash: passwordHash, apiKey: apiKey, + version: version, logger: logger, templates: tmpl, staleThreshold: staleThreshold, diff --git a/hub/internal/web/templates/config_detail.html b/hub/internal/web/templates/config_detail.html index a53c303..9a29520 100644 --- a/hub/internal/web/templates/config_detail.html +++ b/hub/internal/web/templates/config_detail.html @@ -123,7 +123,7 @@
-

Felhom Hub — Customer Management

+

Felhom Hub {{hubVersion}} — Customer Management

diff --git a/hub/internal/web/templates/config_form.html b/hub/internal/web/templates/config_form.html index e7f82cb..d3899cb 100644 --- a/hub/internal/web/templates/config_form.html +++ b/hub/internal/web/templates/config_form.html @@ -142,7 +142,7 @@
-

Felhom Hub — Configuration Management

+

Felhom Hub {{hubVersion}} — Configuration Management

diff --git a/hub/internal/web/templates/configs.html b/hub/internal/web/templates/configs.html index 8ce7b4e..295d783 100644 --- a/hub/internal/web/templates/configs.html +++ b/hub/internal/web/templates/configs.html @@ -76,7 +76,7 @@ {{end}}
-

Felhom Hub — Customer Management

+

Felhom Hub {{hubVersion}} — Customer Management

diff --git a/hub/internal/web/templates/customer.html b/hub/internal/web/templates/customer.html index 51b4a06..7a5ad4d 100644 --- a/hub/internal/web/templates/customer.html +++ b/hub/internal/web/templates/customer.html @@ -337,7 +337,7 @@ {{end}}
-

Auto-refreshes every 60 seconds · Felhom Hub

+

Auto-refreshes every 60 seconds · Felhom Hub {{hubVersion}}

diff --git a/hub/internal/web/templates/customer_unified.html b/hub/internal/web/templates/customer_unified.html index e30a0b6..3b74664 100644 --- a/hub/internal/web/templates/customer_unified.html +++ b/hub/internal/web/templates/customer_unified.html @@ -537,7 +537,7 @@ {{end}}
- {{if .HasReports}}

Auto-refreshes every 60 seconds · {{end}}Felhom Hub{{if .HasReports}}

{{end}} + {{if .HasReports}}

Auto-refreshes every 60 seconds · {{end}}Felhom Hub {{hubVersion}}{{if .HasReports}}

{{end}}
diff --git a/hub/internal/web/templates/dashboard.html b/hub/internal/web/templates/dashboard.html index 4db3473..b7fe7fc 100644 --- a/hub/internal/web/templates/dashboard.html +++ b/hub/internal/web/templates/dashboard.html @@ -65,7 +65,7 @@ {{end}}