Attemping to fix bulk upload problem

This commit is contained in:
2026-07-12 16:11:02 -04:00
parent 119d4100b5
commit b075433e6e
6 changed files with 68 additions and 13 deletions
+20 -7
View File
@@ -7,6 +7,7 @@ import (
"log"
"net/http"
"os"
"runtime/debug"
"golang.org/x/crypto/bcrypt"
@@ -83,13 +84,13 @@ func main() {
http.HandleFunc("/signin", authMid.RedirectIfAuthed(authH.ServeSignin))
http.HandleFunc("/signout", authH.ServeSignout)
// Protected routes.
http.HandleFunc("/", authMid.RequireAuth(epH.ServeDashboard))
http.HandleFunc("/episodes/new", authMid.RequireAuth(epH.ServeNew))
http.HandleFunc("/episodes/edit", authMid.RequireAuth(epH.ServeEdit))
http.HandleFunc("/episodes/delete", authMid.RequireAuth(epH.ServeDelete))
http.HandleFunc("/settings", authMid.RequireAuth(setH.ServeSettings))
http.HandleFunc("/import", authMid.RequireAuth(importH.ServeImport))
// Protected routes with panic recovery.
http.HandleFunc("/", recovery(authMid.RequireAuth(epH.ServeDashboard)))
http.HandleFunc("/episodes/new", recovery(authMid.RequireAuth(epH.ServeNew)))
http.HandleFunc("/episodes/edit", recovery(authMid.RequireAuth(epH.ServeEdit)))
http.HandleFunc("/episodes/delete", recovery(authMid.RequireAuth(epH.ServeDelete)))
http.HandleFunc("/settings", recovery(authMid.RequireAuth(setH.ServeSettings)))
http.HandleFunc("/import", recovery(authMid.RequireAuth(importH.ServeImport)))
// Public RSS: /rss/my-slug or /rss?slug=my-slug or /rss?user=N (legacy)
http.HandleFunc("/rss", rssH.ServeRSS)
@@ -106,6 +107,18 @@ func main() {
log.Fatal(http.ListenAndServe(addr, nil))
}
func recovery(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
defer func() {
if err := recover(); err != nil {
log.Printf("panic: %v\n%s", err, debug.Stack())
http.Error(w, "Internal server error", http.StatusInternalServerError)
}
}()
next(w, r)
}
}
func runAddUser() {
if len(os.Args) != 4 {
log.Fatalf("Usage: podstalk adduser <email> <password>")