From a5fec20d31d90e861caaf12a1bb71dc03f3a800b Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sat, 21 Feb 2026 15:08:45 +0100 Subject: [PATCH] fix: setup wizard logo not loading The logo handler tried os.ReadFile() on a non-existent filesystem path. The SVG only exists as an embedded string constant in the web package. Export FelhomLogoSVG and serve it directly in the setup handler. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 4 ++++ controller/internal/setup/handlers.go | 9 ++------- controller/internal/web/server.go | 2 +- controller/internal/web/templates.go | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cd41c2..64c9d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### v0.22.2 — Setup Logo Fix (2026-02-21) + +- **Fix setup wizard logo**: Logo failed to load because `handleLogo()` tried to read it as a file from the filesystem, but it only exists as an embedded string constant. Now imports and serves `web.FelhomLogoSVG` directly. + ### v0.22.1 — Setup Wizard Bugfixes (2026-02-21) - **Fix setup mode detection**: Remove `demo-felhom` from `NeedsSetup()` check — only empty `customer.id` triggers setup mode. Previously the demo customer was stuck in setup mode. diff --git a/controller/internal/setup/handlers.go b/controller/internal/setup/handlers.go index ff5f9bb..b1507d0 100644 --- a/controller/internal/setup/handlers.go +++ b/controller/internal/setup/handlers.go @@ -21,6 +21,7 @@ import ( "gitea.dooplex.hu/admin/felhom-controller/internal/config" "gitea.dooplex.hu/admin/felhom-controller/internal/report" "gitea.dooplex.hu/admin/felhom-controller/internal/settings" + "gitea.dooplex.hu/admin/felhom-controller/internal/web" "golang.org/x/crypto/bcrypt" ) @@ -291,15 +292,9 @@ func (s *Server) handleCSS(w http.ResponseWriter, r *http.Request) { } func (s *Server) handleLogo(w http.ResponseWriter, r *http.Request) { - logoPath := filepath.Join(filepath.Dir(s.dataDir), "..", "internal", "web", "static", "felhom-logo.svg") - data, err := os.ReadFile(logoPath) - if err != nil { - http.NotFound(w, r) - return - } w.Header().Set("Content-Type", "image/svg+xml") w.Header().Set("Cache-Control", "public, max-age=86400") - w.Write(data) + fmt.Fprint(w, web.FelhomLogoSVG) } // --- Processing Logic --- diff --git a/controller/internal/web/server.go b/controller/internal/web/server.go index a64edbf..f01ef74 100644 --- a/controller/internal/web/server.go +++ b/controller/internal/web/server.go @@ -278,7 +278,7 @@ func (s *Server) serveChartJSHandler(w http.ResponseWriter, r *http.Request) { func (s *Server) serveLogoHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "image/svg+xml") w.Header().Set("Cache-Control", "public, max-age=86400") - fmt.Fprint(w, felhomLogoSVG) + fmt.Fprint(w, FelhomLogoSVG) } // serveAsset serves baked-in app assets (logos, screenshots) from /usr/share/felhom/assets/ diff --git a/controller/internal/web/templates.go b/controller/internal/web/templates.go index 9e4feb9..4b3afbe 100644 --- a/controller/internal/web/templates.go +++ b/controller/internal/web/templates.go @@ -1,8 +1,8 @@ package web -// felhomLogoSVG is the felhom.eu logo, served at /static/felhom-logo.svg. +// FelhomLogoSVG is the felhom.eu logo, served at /static/felhom-logo.svg. // Cleaned from the original Inkscape SVG, removing editor metadata. -const felhomLogoSVG = ` +const FelhomLogoSVG = `