Compare commits

...
1 Commits
Author SHA1 Message Date
JosephFerano 64e1d8c0f4 Fix endpoint issue 2026-10-27 17:57:58 +07:00
+2 -1
View File
@@ -72,7 +72,8 @@ func serve(ctx context.Context) error {
// dist/web/MoonMiners beside this checkout); without one, / goes to the admin. // dist/web/MoonMiners beside this checkout); without one, / goes to the admin.
webDir := env("MM_WEB_DIR", "../client/dist/web/MoonMiners") webDir := env("MM_WEB_DIR", "../client/dist/web/MoonMiners")
if st, err := os.Stat(webDir + "/index.html"); err == nil && !st.IsDir() { if st, err := os.Stat(webDir + "/index.html"); err == nil && !st.IsDir() {
mux.Handle("GET /", http.FileServerFS(os.DirFS(webDir))) // "/", not "GET /": that would conflict with the method-less /utils patterns (panic)
mux.Handle("/", http.FileServerFS(os.DirFS(webDir)))
} else { } else {
mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/utils", http.StatusSeeOther) http.Redirect(w, r, "/utils", http.StatusSeeOther)