Subsonic: sharing (getShares, createShare, updateShare, deleteShare) plus real public share web pages and stream route
This commit is contained in:
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.noroutes.net/NoRoutes/vibetunes/internal/database"
|
||||
assets "git.noroutes.net/NoRoutes/vibetunes/web"
|
||||
@@ -24,6 +25,9 @@ func (h *Web) NewRouter() http.Handler {
|
||||
mux.HandleFunc("POST /login", h.handleLogin)
|
||||
mux.HandleFunc("POST /logout", h.handleLogout)
|
||||
|
||||
mux.HandleFunc("GET /share/{token}", h.handleSharePage)
|
||||
mux.HandleFunc("GET /share/{token}/stream/{songID}", h.handleShareStream)
|
||||
|
||||
mux.HandleFunc("GET /{$}", h.requireUser(h.handleHome))
|
||||
mux.HandleFunc("GET /search", h.requireUser(h.handleSearch))
|
||||
|
||||
@@ -91,7 +95,7 @@ func (h *Web) requireAdmin(fn http.HandlerFunc) http.HandlerFunc {
|
||||
func (h *Web) setupGate(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/setup" || r.URL.Path == "/healthz" || r.URL.Path == "/readyz" ||
|
||||
len(r.URL.Path) >= 8 && r.URL.Path[:8] == "/static/" {
|
||||
strings.HasPrefix(r.URL.Path, "/static/") || strings.HasPrefix(r.URL.Path, "/share/") {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user