This commit is contained in:
ponzischeme89
2026-08-16 12:13:51 +12:00
parent bd3732fba5
commit b9374baaf1
47 changed files with 2793 additions and 364 deletions
+7
View File
@@ -102,6 +102,8 @@ func (s *Server) adminRoutes() http.Handler {
mux.Handle("GET /admin/api/tasks", s.adminAuth(s.handleAdminTasks))
mux.Handle("POST /admin/api/tasks/{taskID}/run", s.adminAuth(s.handleAdminRunTask))
mux.Handle("PUT /admin/api/tasks/{taskID}", s.adminAuth(s.handleAdminTaskSettings))
mux.Handle("GET /admin/api/credits", s.adminAuth(s.handleAdminCredits))
mux.Handle("PUT /admin/api/credits", s.adminAuth(s.handleAdminCredits))
// An unmatched API path is a 404, stated rather than left to the catch-all below —
// otherwise a mistyped or removed route would answer with the console's HTML shell,
@@ -229,6 +231,7 @@ type adminStatus struct {
// ServerVersion is what the page's footer reports. An operator reading the live log
// needs to know which build wrote it, and the page is the one place that is asked.
ServerVersion string `json:"serverVersion"`
CurrentUser string `json:"currentUser,omitempty"`
Maintenance store.Maintenance `json:"maintenance"`
UpdatePolicy appupdate.Policy `json:"updatePolicy"`
Library store.LibraryStats `json:"library"`
@@ -293,6 +296,10 @@ func (s *Server) handleAdminStatus(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, http.StatusOK, adminStatus{
ServerVersion: buildinfo.Version(),
CurrentUser: func() string {
_, username, _ := s.browserSession(r, adminSessionPurpose)
return username
}(),
Maintenance: s.maintenance.get(),
UpdatePolicy: s.updatePolicy.get(),
Library: stats,