feat(web): add automated build version tracking and update notification banner
This commit is contained in:
+10
-3
@@ -47,9 +47,8 @@ import (
|
||||
// @host localhost:8080
|
||||
// @BasePath /api/v1
|
||||
// @schemes http https
|
||||
// @securityDefinitions.apikey SessionAuth
|
||||
// @in cookie
|
||||
// @name dumpster_session
|
||||
var GitSHA = "dev"
|
||||
|
||||
func main() {
|
||||
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
|
||||
|
||||
@@ -153,6 +152,14 @@ func main() {
|
||||
|
||||
// API routes
|
||||
r.Route("/api/v1", func(r chi.Router) {
|
||||
r.Get("/version", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
"version": GitSHA,
|
||||
})
|
||||
})
|
||||
|
||||
// Auth (public: register, login, logout) with strict rate limiting
|
||||
r.Route("/auth", func(r chi.Router) {
|
||||
r.Use(middleware.RateLimit(5, 10)) // 5 req/s, burst 10
|
||||
|
||||
Reference in New Issue
Block a user