Checkpoint audio-only Skald fork work

This commit is contained in:
Storm Dragon
2026-05-18 13:06:57 -04:00
parent a8ada950d5
commit 965347cad4
48 changed files with 1080 additions and 3651 deletions
+16 -16
View File
@@ -50,7 +50,7 @@ func checkPasswordAdmin(w http.ResponseWriter, r *http.Request, hallname, user s
desc, err := hall.GetDescription(hallname)
if err != nil {
internalError(w,
"Get description for group %v: %v",
"Get description for hall %v: %v",
hallname, err,
)
return false
@@ -168,15 +168,15 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
return
}
w.Header().Set("cache-control", "no-cache")
sendJSON(w, r, stats.GetGroups())
sendJSON(w, r, stats.GetHalls())
case ".halls":
apiGroupHandler(w, r, rest)
apiHallHandler(w, r, rest)
default:
http.NotFound(w, r)
}
}
func apiGroupHandler(w http.ResponseWriter, r *http.Request, pth string) {
func apiHallHandler(w http.ResponseWriter, r *http.Request, pth string) {
first, kind, rest := splitPath(pth)
g := ""
if first != "" {
@@ -193,12 +193,12 @@ func apiGroupHandler(w http.ResponseWriter, r *http.Request, pth string) {
methodNotAllowed(w, "HEAD, GET")
return
}
groups, err := hall.GetDescriptionNames()
halls, err := hall.GetDescriptionNames()
if err != nil {
httpError(w, err)
return
}
sendJSON(w, r, groups)
sendJSON(w, r, halls)
return
}
@@ -562,7 +562,7 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
}
if g != "" {
// check that the group exists
// check that the hall exists
_, err := hall.GetDescription(g)
if err != nil {
httpError(w, err)
@@ -592,7 +592,7 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
if done {
return
}
if newtoken.Token != "" || newtoken.Group != "" {
if newtoken.Token != "" || newtoken.Hall != "" {
http.Error(w, "overspecified token",
http.StatusBadRequest)
return
@@ -601,7 +601,7 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
rand.Read(buf)
newtoken.Token =
base64.RawURLEncoding.EncodeToString(buf)
newtoken.Group = g
newtoken.Hall = g
t, err := token.Update(&newtoken, "")
if err != nil {
httpError(w, err)
@@ -626,13 +626,13 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
httpError(w, err)
return
}
if old.Group != g {
if old.Hall != g {
http.NotFound(w, r)
return
}
tok := old.Clone()
tok.Token = ""
tok.Group = ""
tok.Hall = ""
w.Header().Set("etag", etag)
done := checkPreconditions(w, r, etag)
if done {
@@ -649,8 +649,8 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
httpError(w, err)
return
}
if old.Group != g {
http.Error(w, "token exists in different group",
if old.Hall != g {
http.Error(w, "token exists in different hall",
http.StatusConflict)
return
}
@@ -665,12 +665,12 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
if done {
return
}
if newtoken.Group != "" || newtoken.Token != "" {
if newtoken.Hall != "" || newtoken.Token != "" {
http.Error(w, "overspecified token",
http.StatusBadRequest)
return
}
newtoken.Group = g
newtoken.Hall = g
newtoken.Token = t
_, err = token.Update(&newtoken, etag)
if err != nil {
@@ -689,7 +689,7 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
httpError(w, err)
return
}
if old.Group != g {
if old.Hall != g {
http.NotFound(w, r)
return
}