diff --git a/internal/httpservers/webuiServer.go b/internal/httpservers/webuiServer.go index 83b7bde..a9c73e8 100644 --- a/internal/httpservers/webuiServer.go +++ b/internal/httpservers/webuiServer.go @@ -135,11 +135,24 @@ func startWebUIServer(cfg *config.Config) { setupCustomWebuiDir() mux := http.NewServeMux() - mux.Handle("/", http.FileServer(http.Dir(findWebuiDir()))) mux.Handle("/custom-webui/", http.StripPrefix("/custom-webui/", http.FileServer(http.Dir(findCustomWebuiDir())))) mux.HandleFunc("/theme.css", generateThemeCss) mux.HandleFunc("/webUiSettings.json", generateWebUISettings) + webuiDir := findWebuiDir() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + dirName := path.Dir(r.URL.Path) + + // Mangle requests for any path like /logs or /config to load the webui index.html + if path.Ext(r.URL.Path) == "" && r.URL.Path != "/" { + log.Infof("Mangling request for %s to /index.html", r.URL.Path) + + http.ServeFile(w, r, path.Join(webuiDir, "index.html")) + } else { + http.StripPrefix(dirName, http.FileServer(http.Dir(webuiDir))).ServeHTTP(w, r) + } + }) + srv := &http.Server{ Addr: cfg.ListenAddressWebUI, Handler: mux, diff --git a/webui.dev/index.html b/webui.dev/index.html index 14f8850..f7d0907 100644 --- a/webui.dev/index.html +++ b/webui.dev/index.html @@ -8,8 +8,8 @@ OliveTin - - + + @@ -17,6 +17,8 @@ + + @@ -28,16 +30,16 @@ @@ -64,7 +66,6 @@