From e971128cdc64aa81bba134faa65dc53bc2680d60 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 30 Apr 2026 09:31:49 +0300 Subject: fix: allow static assets during bootstrap when no users exist The BootstrapRedirect middleware was blocking /css/ and /js/ requests when no users existed, which prevented the bootstrap.html page from loading its stylesheets and scripts. This caused the form to submit as raw form data (rather than JSON via the JS API) and silently fail. - Added /css/* and /js/* to isBootstrapPublic() so static assets are served without redirect when no users exist. - Also added /images/, /favicon.svg, /manifest.json, and /sw.js for completeness. --- internal/api/middleware.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/api/middleware.go') diff --git a/internal/api/middleware.go b/internal/api/middleware.go index 70da80b..5b99cc7 100644 --- a/internal/api/middleware.go +++ b/internal/api/middleware.go @@ -3,6 +3,7 @@ package api import ( "context" "net/http" + "strings" "github.com/paul/kiss-media-player/internal/auth" "github.com/paul/kiss-media-player/internal/model" @@ -85,7 +86,11 @@ func (mw *Middleware) BootstrapRedirect(next http.Handler) http.Handler { func isBootstrapPublic(path string) bool { switch path { - case "/bootstrap.html", "/api/bootstrap", "/login.html", "/api/login", "/healthz", "/readyz": + case "/bootstrap.html", "/api/bootstrap", "/login.html", "/api/login", "/healthz", "/readyz", + "/favicon.svg", "/manifest.json", "/sw.js": + return true + } + if strings.HasPrefix(path, "/css/") || strings.HasPrefix(path, "/js/") || strings.HasPrefix(path, "/images/") { return true } return false -- cgit v1.2.3