diff options
author | Russell Aunger <rba@live.com> | 2019-03-18 22:33:20 -0400 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-18 22:33:20 -0400 |
commit | b34996a62937b23121d19912b37ed2b1023f1479 (patch) | |
tree | 9a080ef145d738c71956279980bd7f56b70b6825 /routers/routes | |
parent | cac9e6e7605184f5679b1ebfbe5b5805191d9a53 (diff) | |
download | gitea-b34996a62937b23121d19912b37ed2b1023f1479.tar.gz gitea-b34996a62937b23121d19912b37ed2b1023f1479.zip |
Implement Default Webhooks (#4299)
Partially implement #770.
Add "Default Webhooks" page in site admin UI.
Persist to the existing webhooks table, but store with RepoID=0 and OrgID=0.
Upon repo creation, copy the set of default webhooks into the new repo.
Diffstat (limited to 'routers/routes')
-rw-r--r-- | routers/routes/routes.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 5f55d6cf9d..fafef0830e 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -373,6 +373,23 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/delete", admin.DeleteRepo) }) + m.Group("/hooks", func() { + m.Get("", admin.DefaultWebhooks) + m.Post("/delete", admin.DeleteDefaultWebhook) + m.Get("/:type/new", repo.WebhooksNew) + m.Post("/gitea/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost) + m.Post("/gogs/new", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksNewPost) + m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost) + m.Post("/discord/new", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksNewPost) + m.Post("/dingtalk/new", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksNewPost) + m.Get("/:id", repo.WebHooksEdit) + m.Post("/gitea/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost) + m.Post("/gogs/:id", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksEditPost) + m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost) + m.Post("/discord/:id", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksEditPost) + m.Post("/dingtalk/:id", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksEditPost) + }) + m.Group("/auths", func() { m.Get("", admin.Authentications) m.Combo("/new").Get(admin.NewAuthSource).Post(bindIgnErr(auth.AuthenticationForm{}), admin.NewAuthSourcePost) |