(mux *http.ServeMux)
| 222 | } |
| 223 | |
| 224 | func (s *Server) mountFallback(mux *http.ServeMux) { |
| 225 | mux.HandleFunc("/{path...}", func(w http.ResponseWriter, r *http.Request) { |
| 226 | if len(r.URL.Path) >= 4 && r.URL.Path[:4] == "/api" { |
| 227 | http.NotFound(w, r) |
| 228 | return |
| 229 | } |
| 230 | w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| 231 | fmt.Fprint(w, `<!DOCTYPE html> |
| 232 | <html><body style="font-family:system-ui;max-width:480px;margin:80px auto;text-align:center"> |
| 233 | <h2>taskmd</h2> |
| 234 | <p>No web UI embedded in this build.</p> |
| 235 | <p>Rebuild with <code>make build-full</code> or use <code>--dev</code> mode with the Vite dev server.</p> |
| 236 | </body></html>`) |
| 237 | }) |
| 238 | } |
| 239 | |
| 240 | func corsMiddleware(next http.Handler) http.Handler { |
| 241 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
no outgoing calls