diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 09:38:31 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 09:38:31 -0800 |
| commit | 23947045c011e84149bc1b9d48805e57bb0bb3ba (patch) | |
| tree | a4eb5015a5456a0ac93a792f59270675beccabd5 /web/web.go | |
| parent | 22eacbaf2712aee2a1c448a0e53f241f8c7bd255 (diff) | |
| download | neko-23947045c011e84149bc1b9d48805e57bb0bb3ba.tar.gz neko-23947045c011e84149bc1b9d48805e57bb0bb3ba.tar.bz2 neko-23947045c011e84149bc1b9d48805e57bb0bb3ba.zip | |
routing: make new UI default at / and move legacy UI to /v1/ (fixing NK-mgmn5m, NK-p89hyt)
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -223,8 +223,14 @@ func NewRouter(cfg *config.Settings) http.Handler { mux.Handle("/static/", GzipMiddleware(http.StripPrefix("/static/", http.FileServer(http.FS(staticSub))))) // New Frontend (React/Vite) from web/dist/v2 + // Default route + mux.Handle("/", GzipMiddleware(http.HandlerFunc(ServeFrontend))) + // Also keep /v2/ for explicit access mux.Handle("/v2/", GzipMiddleware(http.StripPrefix("/v2/", http.HandlerFunc(ServeFrontend)))) + // Legacy UI at /v1/ + mux.Handle("/v1/", GzipMiddleware(http.StripPrefix("/v1/", AuthWrap(http.HandlerFunc(indexHandler))))) + // New REST API apiServer := api.NewServer(cfg) // We need to mount the raw mux from apiServer if we want /api/ access, @@ -257,7 +263,7 @@ func NewRouter(cfg *config.Settings) http.Handler { mux.HandleFunc("/api/logout", apiLogoutHandler) mux.HandleFunc("/api/auth", apiAuthStatusHandler) - mux.Handle("/", GzipMiddleware(AuthWrap(http.HandlerFunc(indexHandler)))) + // Removed default root handler for legacy UI return SecurityHeadersMiddleware(CSRFMiddleware(mux)) } |
