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:
2026-02-21 15:08:45 +01:00
parent 296fdbfdcb
commit a5fec20d31
4 changed files with 9 additions and 10 deletions
+2 -7
View File
@@ -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 ---
+1 -1
View File
@@ -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/
+2 -2
View File
@@ -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>