Implement global tokens.

This commit is contained in:
Juliusz Chroboczek
2025-08-12 18:13:14 +02:00
parent 630a316baf
commit b78b2c040d
4 changed files with 63 additions and 9 deletions
+10 -9
View File
@@ -155,11 +155,10 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
func apiGroupHandler(w http.ResponseWriter, r *http.Request, pth string) {
first, kind, rest := splitPath(pth)
if first == "" {
notFound(w)
return
g := ""
if first != "" {
g = first[1:]
}
g := first[1:]
if g == "" && kind == "" {
if apiCORS(w, r, "HEAD, GET") {
return
@@ -537,11 +536,13 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
return
}
// check that the group exists
_, err := group.GetDescription(g)
if err != nil {
httpError(w, err)
return
if g != "" {
// check that the group exists
_, err := group.GetDescription(g)
if err != nil {
httpError(w, err)
return
}
}
if pth == "/" {
if r.Method == "HEAD" || r.Method == "GET" {