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 <noreply@anthropic.com>
This commit is contained in:
@@ -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**
|
||||
|
||||
+1
-1
@@ -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**
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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,6 +41,7 @@ func New(store *store.Store, passwordHash, apiKey string, staleThreshold time.Du
|
||||
b, _ := json.Marshal(v)
|
||||
return template.JS(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 {
|
||||
@@ -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,
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>Felhom Hub — Customer Management</p>
|
||||
<p>Felhom Hub {{hubVersion}} — Customer Management</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</form>
|
||||
|
||||
<footer>
|
||||
<p>Felhom Hub — Configuration Management</p>
|
||||
<p>Felhom Hub {{hubVersion}} — Configuration Management</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
{{end}}
|
||||
|
||||
<footer>
|
||||
<p>Felhom Hub — Customer Management</p>
|
||||
<p>Felhom Hub {{hubVersion}} — Customer Management</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -337,7 +337,7 @@
|
||||
{{end}}
|
||||
|
||||
<footer>
|
||||
<p>Auto-refreshes every 60 seconds · <a href="/">Felhom Hub</a></p>
|
||||
<p>Auto-refreshes every 60 seconds · <a href="/">Felhom Hub</a> {{hubVersion}}</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -537,7 +537,7 @@
|
||||
{{end}}
|
||||
|
||||
<footer>
|
||||
{{if .HasReports}}<p>Auto-refreshes every 60 seconds · {{end}}<a href="/">Felhom Hub</a>{{if .HasReports}}</p>{{end}}
|
||||
{{if .HasReports}}<p>Auto-refreshes every 60 seconds · {{end}}<a href="/">Felhom Hub</a> {{hubVersion}}{{if .HasReports}}</p>{{end}}
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
{{end}}
|
||||
|
||||
<footer>
|
||||
<p>Auto-refreshes every 60 seconds · Felhom Hub</p>
|
||||
<p>Auto-refreshes every 60 seconds · Felhom Hub {{hubVersion}}</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user