summaryrefslogtreecommitdiffstats
path: root/routers/routes
diff options
context:
space:
mode:
authorRussell Aunger <rba@live.com>2019-03-18 22:33:20 -0400
committertechknowlogick <matti@mdranta.net>2019-03-18 22:33:20 -0400
commitb34996a62937b23121d19912b37ed2b1023f1479 (patch)
tree9a080ef145d738c71956279980bd7f56b70b6825 /routers/routes
parentcac9e6e7605184f5679b1ebfbe5b5805191d9a53 (diff)
downloadgitea-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.go17
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)