refresh handler

This commit is contained in:
2026-04-15 14:13:28 -06:00
parent bbaa6396b0
commit 58f9093406
5 changed files with 59 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
package main
import (
"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 {
http.Error(w, "refresh failed", http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusNoContent)
}