fix silly admin routing nonsense

This commit is contained in:
ari melody 2025-11-08 14:13:42 +00:00
parent 09c09b6310
commit a33e6717e0
Signed by: ari
GPG key ID: CF99829C92678188
6 changed files with 57 additions and 58 deletions

View file

@ -9,17 +9,23 @@ func Handler(app *model.AppState) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mux := http.NewServeMux()
mux.Handle("/releases/", http.StripPrefix("/releases", serveReleases(app)))
mux.HandleFunc("/music/releases/{id}/", func(w http.ResponseWriter, r *http.Request) {
serveEditRelease(app, r.PathValue("id")).ServeHTTP(w, r)
})
mux.HandleFunc("/music/releases/{id}", func(w http.ResponseWriter, r *http.Request) {
serveRelease(app, r.PathValue("id")).ServeHTTP(w, r)
})
mux.Handle("/music/releases/", serveReleases(app))
mux.HandleFunc("/artists/{id}", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/music/artists/{id}", func(w http.ResponseWriter, r *http.Request) {
serveArtist(app, r.PathValue("id")).ServeHTTP(w, r)
})
mux.Handle("/artists/", http.StripPrefix("/artists", serveArtists(app)))
mux.Handle("/music/artists/", serveArtists(app))
mux.HandleFunc("/tracks/{id}", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/music/tracks/{id}", func(w http.ResponseWriter, r *http.Request) {
serveTrack(app, r.PathValue("id")).ServeHTTP(w, r)
})
mux.Handle("/tracks/", http.StripPrefix("/tracks", serveTracks(app)))
mux.Handle("/music/tracks/", serveTracks(app))
mux.ServeHTTP(w, r)
})