webhooks: add "user created" webhook
Webhooks send a POST to an admin-supplied URL when something happens, with relevant information sent in JSON. One has been added for creating users in Settings > Webhooks > User Created. Lazily, the portion of GetUsers which generates a respUser has been factored out, and is called to send the JSON payload. A stripped-down common.Req method has been added, which is used by the barebones WebhookSender struct.
This commit is contained in:
@@ -121,6 +121,7 @@ type appContext struct {
|
||||
version string
|
||||
URLBase, ExternalURI, ExternalDomain string
|
||||
updater *Updater
|
||||
webhooks *WebhookSender
|
||||
newUpdate bool // Whether whatever's in update is new.
|
||||
tag Tag
|
||||
update Update
|
||||
@@ -556,8 +557,14 @@ func start(asDaemon, firstCall bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// Non-consequential if we don't need it
|
||||
app.webhooks = NewWebhookSender(
|
||||
common.NewTimeoutHandler("Webhook", "?", true),
|
||||
app.debug,
|
||||
)
|
||||
|
||||
// Updater proxy set in config.go, don't worry!
|
||||
if app.proxyEnabled {
|
||||
app.updater.SetTransport(app.proxyTransport)
|
||||
app.jf.SetTransport(app.proxyTransport)
|
||||
for _, c := range app.thirdPartyServices {
|
||||
c.SetTransport(app.proxyTransport)
|
||||
|
||||
Reference in New Issue
Block a user