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 <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 ---
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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 = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
const FelhomLogoSVG = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 645.30703 408.36403" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<linearGradient id="lg9"><stop offset="0"/><stop offset="0.99875164" style="stop-color:rgb(4,114,187)"/></linearGradient>
|
||||
|
||||
Reference in New Issue
Block a user