diff --git a/audit/internal/webui/api.go b/audit/internal/webui/api.go index ae9a394..81a4a05 100644 --- a/audit/internal/webui/api.go +++ b/audit/internal/webui/api.go @@ -1292,6 +1292,22 @@ func (h *handler) handleAPIInstallToRAM(w http.ResponseWriter, r *http.Request) _ = json.NewEncoder(w).Encode(map[string]string{"task_id": t.ID}) } +func (h *handler) handleAPISystemReboot(w http.ResponseWriter, r *http.Request) { + if err := exec.Command("systemctl", "reboot").Start(); err != nil { + writeError(w, http.StatusInternalServerError, "reboot failed: "+err.Error()) + return + } + writeJSON(w, map[string]string{"status": "rebooting"}) +} + +func (h *handler) handleAPISystemShutdown(w http.ResponseWriter, r *http.Request) { + if err := exec.Command("systemctl", "poweroff").Start(); err != nil { + writeError(w, http.StatusInternalServerError, "shutdown failed: "+err.Error()) + return + } + writeJSON(w, map[string]string{"status": "shutting down"}) +} + // ── Tools ───────────────────────────────────────────────────────────────────── var standardTools = []string{ diff --git a/audit/internal/webui/page_settings.go b/audit/internal/webui/page_settings.go index 81bbb93..1dbc242 100644 --- a/audit/internal/webui/page_settings.go +++ b/audit/internal/webui/page_settings.go @@ -88,5 +88,28 @@ checkTools(); +