Server qr fixes.
Some checks failed
CI / Test (1.23) (push) Failing after -25m23s
CI / Test (1.22) (push) Failing after -25m21s
CI / Build (push) Failing after -25m59s
CI / Lint (push) Successful in -25m51s

This commit is contained in:
2025-12-29 22:44:10 +02:00
parent 94fc899bab
commit fd2527219e
7 changed files with 202 additions and 76 deletions

View File

@@ -34,12 +34,14 @@ func (h *Handlers) AddHook(w http.ResponseWriter, r *http.Request) {
h.config.Hooks = h.hookMgr.ListHooks()
if h.configPath != "" {
if err := config.Save(h.configPath, h.config); err != nil {
logging.Error("Failed to save config", "error", err)
logging.Error("Failed to save config after adding hook", "hook_id", hook.ID, "error", err)
} else {
logging.Info("Config saved after adding hook", "hook_id", hook.ID)
}
}
w.WriteHeader(http.StatusCreated)
writeJSON(w, map[string]string{"status": "ok"})
writeJSON(w, map[string]string{"status": "ok", "hook_id": hook.ID})
}
// RemoveHook removes a hook from the system
@@ -66,7 +68,9 @@ func (h *Handlers) RemoveHook(w http.ResponseWriter, r *http.Request) {
h.config.Hooks = h.hookMgr.ListHooks()
if h.configPath != "" {
if err := config.Save(h.configPath, h.config); err != nil {
logging.Error("Failed to save config", "error", err)
logging.Error("Failed to save config after removing hook", "hook_id", req.ID, "error", err)
} else {
logging.Info("Config saved after removing hook", "hook_id", req.ID)
}
}