Update list of Not Implemented / Gone Subsonic API endpoints

This commit is contained in:
Deluan
2021-02-09 21:25:14 -05:00
parent 1c285439ca
commit 107803e037
+31 -7
View File
@@ -154,12 +154,21 @@ func (api *Router) routes() http.Handler {
h(withPlayer, "download", c.Download) h(withPlayer, "download", c.Download)
}) })
// Deprecated/Out of scope endpoints // Not Implemented (yet?)
h410(r, "getChatMessages") h501(r, "getLyrics")
h410(r, "addChatMessage") h501(r, "jukeboxControl")
h410(r, "getVideos") h501(r, "getAlbumInfo", "getAlbumInfo2")
h410(r, "getVideoInfo") h501(r, "getShares", "createShare", "updateShare", "deleteShare")
h410(r, "getCaptions") h501(r, "getPodcasts", "getNewestPodcasts", "refreshPodcasts", "createPodcastChannel", "deletePodcastChannel",
"deletePodcastEpisode", "downloadPodcastEpisode")
h501(r, "getInternetRadioStations", "createInternetRadioStation", "updateInternetRadioStation",
"deleteInternetRadioStation")
h501(r, "createUser", "updateUser", "deleteUser", "changePassword")
// Deprecated/Won't implement/Out of scope endpoints
h410(r, "search")
h410(r, "getChatMessages", "addChatMessage")
h410(r, "getVideos", "getVideoInfo", "getCaptions", "hls")
return r return r
} }
@@ -188,14 +197,29 @@ func h(r chi.Router, path string, f handler) {
r.HandleFunc("/"+path+".view", handle) r.HandleFunc("/"+path+".view", handle)
} }
// Add a handler that returns 510 - Not implemented. Used to signal that an endpoint is not implemented yet
func h501(r *chi.Mux, paths ...string) {
for _, path := range paths {
handle := func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Cache-Control", "no-cache")
w.WriteHeader(510)
_, _ = w.Write([]byte("This endpoint is not implemented, but may be in future releases"))
}
r.HandleFunc("/"+path, handle)
r.HandleFunc("/"+path+".view", handle)
}
}
// Add a handler that returns 410 - Gone. Used to signal that an endpoint will not be implemented // Add a handler that returns 410 - Gone. Used to signal that an endpoint will not be implemented
func h410(r chi.Router, path string) { func h410(r chi.Router, paths ...string) {
for _, path := range paths {
handle := func(w http.ResponseWriter, r *http.Request) { handle := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(410) w.WriteHeader(410)
_, _ = w.Write([]byte("This endpoint will not be implemented")) _, _ = w.Write([]byte("This endpoint will not be implemented"))
} }
r.HandleFunc("/"+path, handle) r.HandleFunc("/"+path, handle)
r.HandleFunc("/"+path+".view", handle) r.HandleFunc("/"+path+".view", handle)
}
} }
func sendError(w http.ResponseWriter, r *http.Request, err error) { func sendError(w http.ResponseWriter, r *http.Request, err error) {