More work on hooks

This commit is contained in:
Magnus Åhall 2025-08-07 15:51:15 +02:00
parent 392aa0d11f
commit 2a04cba42a
5 changed files with 164 additions and 4 deletions

View file

@ -50,6 +50,7 @@ func initWebserver() (err error) {
http.HandleFunc("/scripts/", actionScripts)
http.HandleFunc("/scripts/update/{scriptID}", actionScriptUpdate)
http.HandleFunc("/scripts/delete/{scriptID}", actionScriptDelete)
http.HandleFunc("/hooks/update/{hookID}", actionHookUpdate)
err = http.ListenAndServe(address, nil)
return
@ -621,4 +622,27 @@ func actionScriptDelete(w http.ResponseWriter, r *http.Request) { // {{{
w.Write(j)
} // }}}
func actionHookUpdate(w http.ResponseWriter, r *http.Request) { // {{{
hookID := 0
hookIDStr := r.PathValue("hookID")
hookID, _ = strconv.Atoi(hookIDStr)
// XXX - here
err := UpdateHook(hook)
if err != nil {
err = werr.Wrap(err)
httpError(w, err)
return
}
out := struct {
OK bool
}{
true,
}
j, _ := json.Marshal(out)
w.Write(j)
} // }}}
// vim: foldmethod=marker