This commit is contained in:
@@ -34,6 +34,24 @@ func (a *App) routes() {
|
||||
nil, nil, nil,
|
||||
))
|
||||
|
||||
// Maintenance Mode (requires authentication, admin-only for enable/disable)
|
||||
a.mux.HandleFunc("/api/v1/maintenance", methodHandler(
|
||||
func(w http.ResponseWriter, r *http.Request) { a.handleGetMaintenanceStatus(w, r) },
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
adminRole := models.RoleAdministrator
|
||||
a.requireRole(adminRole)(http.HandlerFunc(a.handleEnableMaintenance)).ServeHTTP(w, r)
|
||||
},
|
||||
nil, nil, nil,
|
||||
))
|
||||
a.mux.HandleFunc("/api/v1/maintenance/disable", methodHandler(
|
||||
nil,
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
adminRole := models.RoleAdministrator
|
||||
a.requireRole(adminRole)(http.HandlerFunc(a.handleDisableMaintenance)).ServeHTTP(w, r)
|
||||
},
|
||||
nil, nil, nil,
|
||||
))
|
||||
|
||||
// API Documentation
|
||||
a.mux.HandleFunc("/api/docs", a.handleAPIDocs)
|
||||
a.mux.HandleFunc("/api/openapi.yaml", a.handleOpenAPISpec)
|
||||
|
||||
Reference in New Issue
Block a user