diff options
author | 2023-09-08 22:45:17 -0700 | |
---|---|---|
committer | 2023-09-09 13:11:42 -0700 | |
commit | 48f6885f4472efbe0e23f990ae8d4545f9a6a73d (patch) | |
tree | a05b35013e65f95013f90006b07870ddaeaf4065 /internal/ui/integration_update.go | |
parent | 32d33104a4934771ca99b1bcfe55bd0e4e88809b (diff) | |
download | v2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.tar.gz v2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.tar.zst v2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.zip |
Add generic webhook integration
Diffstat (limited to 'internal/ui/integration_update.go')
-rw-r--r-- | internal/ui/integration_update.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/ui/integration_update.go b/internal/ui/integration_update.go index 4a68691c..b8bfed44 100644 --- a/internal/ui/integration_update.go +++ b/internal/ui/integration_update.go @@ -67,6 +67,18 @@ func (h *handler) updateIntegration(w http.ResponseWriter, r *http.Request) { integration.GoogleReaderPassword = "" } + if integrationForm.WebhookEnabled { + if integrationForm.WebhookURL == "" { + integration.WebhookEnabled = false + integration.WebhookSecret = "" + } else if integration.WebhookSecret == "" { + integration.WebhookSecret = crypto.GenerateRandomStringHex(32) + } + } else { + integration.WebhookURL = "" + integration.WebhookSecret = "" + } + err = h.store.UpdateIntegration(integration) if err != nil { html.ServerError(w, r, err) |