fix(subsonic): route settings.view -> admin home
This commit is contained in:
@@ -120,20 +120,19 @@ func New(opts Options) (*Server, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupMisc(r *mux.Router, ctrl *ctrlbase.Controller) {
|
func setupMisc(r *mux.Router, ctrl *ctrlbase.Controller) {
|
||||||
r.HandleFunc("/",
|
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
func(w http.ResponseWriter, r *http.Request) {
|
adminHome := ctrl.Path("/admin/home")
|
||||||
// make the admin page the default
|
http.Redirect(w, r, adminHome, http.StatusSeeOther)
|
||||||
http.Redirect(w, r, ctrl.Path("/admin/home"), http.StatusSeeOther)
|
})
|
||||||
})
|
// misc subsonic routes without /rest prefix
|
||||||
r.HandleFunc("/musicFolderSettings.view",
|
r.HandleFunc("/settings.view", func(w http.ResponseWriter, r *http.Request) {
|
||||||
func(w http.ResponseWriter, r *http.Request) {
|
adminHome := ctrl.Path("/admin/home")
|
||||||
// jamstash seems to call "musicFolderSettings.view" to start a scan. notice
|
http.Redirect(w, r, adminHome, http.StatusSeeOther)
|
||||||
// that there is no "/rest/" prefix, so i doesn't fit in with the nice router,
|
})
|
||||||
// custom handler, middleware. etc setup that we've got in `SetupSubsonic()`.
|
r.HandleFunc("/musicFolderSettings.view", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// instead lets redirect to down there and use the scan endpoint
|
restScan := ctrl.Path(fmt.Sprintf("/rest/startScan.view?%s", r.URL.Query().Encode()))
|
||||||
redirectTo := fmt.Sprintf("/rest/startScan.view?%s", r.URL.Query().Encode())
|
http.Redirect(w, r, restScan, http.StatusSeeOther)
|
||||||
http.Redirect(w, r, ctrl.Path(redirectTo), http.StatusSeeOther)
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupAdmin(r *mux.Router, ctrl *ctrladmin.Controller) {
|
func setupAdmin(r *mux.Router, ctrl *ctrladmin.Controller) {
|
||||||
|
|||||||
Reference in New Issue
Block a user