Web UI: podcasts, radio, shares, bookmarks pages; admin podcast/jukebox management; per-user Subsonic permission editor
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package web
|
||||
|
||||
import "net/http"
|
||||
|
||||
func (h *Web) handleAdminJukebox(w http.ResponseWriter, r *http.Request) {
|
||||
data := struct {
|
||||
Available bool
|
||||
Status any
|
||||
Error string
|
||||
}{Available: h.Jukebox.Available}
|
||||
|
||||
if h.Jukebox.Available {
|
||||
state, err := h.Jukebox.Status()
|
||||
if err != nil {
|
||||
data.Error = err.Error()
|
||||
} else {
|
||||
data.Status = state
|
||||
}
|
||||
}
|
||||
h.page(w, r, "admin_jukebox", "admin_jukebox", "Jukebox", data)
|
||||
}
|
||||
|
||||
func (h *Web) handleAdminJukeboxStop(w http.ResponseWriter, r *http.Request) {
|
||||
if h.Jukebox.Available {
|
||||
_, _ = h.Jukebox.Stop()
|
||||
}
|
||||
http.Redirect(w, r, "/admin/jukebox", http.StatusFound)
|
||||
}
|
||||
|
||||
func (h *Web) handleAdminJukeboxStart(w http.ResponseWriter, r *http.Request) {
|
||||
if h.Jukebox.Available {
|
||||
_, _ = h.Jukebox.Start()
|
||||
}
|
||||
http.Redirect(w, r, "/admin/jukebox", http.StatusFound)
|
||||
}
|
||||
|
||||
func (h *Web) handleAdminJukeboxClear(w http.ResponseWriter, r *http.Request) {
|
||||
if h.Jukebox.Available {
|
||||
_, _ = h.Jukebox.Clear()
|
||||
}
|
||||
http.Redirect(w, r, "/admin/jukebox", http.StatusFound)
|
||||
}
|
||||
Reference in New Issue
Block a user