renamed handlers

This commit is contained in:
2026-05-05 10:49:13 -06:00
parent 275ae89423
commit dbeaba52d5
3 changed files with 82 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"log/slog"
"net/http"
)
func (s *Server) handlerRefresh(w http.ResponseWriter, req *http.Request) {
if req.Header.Get("Authorization") != "Bearer "+s.cfg.Auth.Token {
http.Error(w, "unauthorized", http.StatusInternalServerError)
return
}
if err := s.c.Refresh(); err != nil {
slog.Error("refresh failed", "err", err)
http.Error(w, "refresh failed", http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) handlerLogLevel(w http.ResponseWriter, req *http.Request) {
if req.Header.Get("Authorization") != "Bearer "+s.cfg.Auth.Token {
http.Error(w, "unauthorized", http.StatusInternalServerError)
return
}
}