summaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-01-05 22:00:20 +0100
committerGitHub <noreply@github.com>2022-01-05 15:00:20 -0600
commitbf7b083cfe47cc922090ce7922b89f7a5030a44d (patch)
tree62291bc31a1dd28252a8802555d09085d30416ee /routers/web/web.go
parenta38ba634a4da15fbb2d1b6ac6742cf01c1503ea4 (diff)
downloadgitea-bf7b083cfe47cc922090ce7922b89f7a5030a44d.tar.gz
gitea-bf7b083cfe47cc922090ce7922b89f7a5030a44d.zip
Add replay of webhooks. (#18191)
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index e35ccb5aab..8abdf7c61f 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -435,7 +435,10 @@ func RegisterRoutes(m *web.Route) {
m.Group("/hooks", func() {
m.Get("", admin.DefaultOrSystemWebhooks)
m.Post("/delete", admin.DeleteDefaultOrSystemWebhook)
- m.Get("/{id}", repo.WebHooksEdit)
+ m.Group("/{id}", func() {
+ m.Get("", repo.WebHooksEdit)
+ m.Post("/replay/{uuid}", repo.ReplayWebhook)
+ })
m.Post("/gitea/{id}", bindIgnErr(forms.NewWebhookForm{}), repo.WebHooksEditPost)
m.Post("/gogs/{id}", bindIgnErr(forms.NewGogshookForm{}), repo.GogsHooksEditPost)
m.Post("/slack/{id}", bindIgnErr(forms.NewSlackHookForm{}), repo.SlackHooksEditPost)
@@ -559,7 +562,10 @@ func RegisterRoutes(m *web.Route) {
m.Post("/msteams/new", bindIgnErr(forms.NewMSTeamsHookForm{}), repo.MSTeamsHooksNewPost)
m.Post("/feishu/new", bindIgnErr(forms.NewFeishuHookForm{}), repo.FeishuHooksNewPost)
m.Post("/wechatwork/new", bindIgnErr(forms.NewWechatWorkHookForm{}), repo.WechatworkHooksNewPost)
- m.Get("/{id}", repo.WebHooksEdit)
+ m.Group("/{id}", func() {
+ m.Get("", repo.WebHooksEdit)
+ m.Post("/replay/{uuid}", repo.ReplayWebhook)
+ })
m.Post("/gitea/{id}", bindIgnErr(forms.NewWebhookForm{}), repo.WebHooksEditPost)
m.Post("/gogs/{id}", bindIgnErr(forms.NewGogshookForm{}), repo.GogsHooksEditPost)
m.Post("/slack/{id}", bindIgnErr(forms.NewSlackHookForm{}), repo.SlackHooksEditPost)
@@ -653,8 +659,11 @@ func RegisterRoutes(m *web.Route) {
m.Post("/msteams/new", bindIgnErr(forms.NewMSTeamsHookForm{}), repo.MSTeamsHooksNewPost)
m.Post("/feishu/new", bindIgnErr(forms.NewFeishuHookForm{}), repo.FeishuHooksNewPost)
m.Post("/wechatwork/new", bindIgnErr(forms.NewWechatWorkHookForm{}), repo.WechatworkHooksNewPost)
- m.Get("/{id}", repo.WebHooksEdit)
- m.Post("/{id}/test", repo.TestWebhook)
+ m.Group("/{id}", func() {
+ m.Get("", repo.WebHooksEdit)
+ m.Post("/test", repo.TestWebhook)
+ m.Post("/replay/{uuid}", repo.ReplayWebhook)
+ })
m.Post("/gitea/{id}", bindIgnErr(forms.NewWebhookForm{}), repo.WebHooksEditPost)
m.Post("/gogs/{id}", bindIgnErr(forms.NewGogshookForm{}), repo.GogsHooksEditPost)
m.Post("/slack/{id}", bindIgnErr(forms.NewSlackHookForm{}), repo.SlackHooksEditPost)