summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authoroliverpool <git@olivier.pfad.fr>2024-03-21 14:09:49 +0100
committeroliverpool <git@olivier.pfad.fr>2024-03-27 15:38:39 +0100
commit4ab341e9714b59fa009af44fb7de61642b6e6e86 (patch)
tree5ea99672deac9e5c4c699f9a652767a7ed8e44e6 /routers
parent[REFACTOR] webhook packagist endpoint (diff)
downloadforgejo-4ab341e9714b59fa009af44fb7de61642b6e6e86.tar.xz
forgejo-4ab341e9714b59fa009af44fb7de61642b6e6e86.zip
[REFACTOR] webhook gogs endpoint
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/setting/webhook.go28
-rw-r--r--routers/web/web.go2
2 files changed, 0 insertions, 30 deletions
diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go
index ea36da649f..e89fcef39a 100644
--- a/routers/web/repo/setting/webhook.go
+++ b/routers/web/repo/setting/webhook.go
@@ -23,7 +23,6 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
- "code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/modules/web/middleware"
webhook_module "code.gitea.io/gitea/modules/webhook"
"code.gitea.io/gitea/services/context"
@@ -361,33 +360,6 @@ func editWebhook(ctx *context.Context, params webhookParams) {
ctx.Redirect(fmt.Sprintf("%s/%d", orCtx.Link, w.ID))
}
-// GogsHooksNewPost response for creating Gogs webhook
-func GogsHooksNewPost(ctx *context.Context) {
- createWebhook(ctx, gogsHookParams(ctx))
-}
-
-// GogsHooksEditPost response for editing Gogs webhook
-func GogsHooksEditPost(ctx *context.Context) {
- editWebhook(ctx, gogsHookParams(ctx))
-}
-
-func gogsHookParams(ctx *context.Context) webhookParams {
- form := web.GetForm(ctx).(*forms.NewGogshookForm)
-
- contentType := webhook.ContentTypeJSON
- if webhook.HookContentType(form.ContentType) == webhook.ContentTypeForm {
- contentType = webhook.ContentTypeForm
- }
-
- return webhookParams{
- Type: webhook_module.GOGS,
- URL: form.PayloadURL,
- ContentType: contentType,
- Secret: form.Secret,
- WebhookForm: form.WebhookForm,
- }
-}
-
func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) {
orCtx, err := getOwnerRepoCtx(ctx)
if err != nil {
diff --git a/routers/web/web.go b/routers/web/web.go
index 4b44a8eac5..348b9546c7 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -402,12 +402,10 @@ func registerRoutes(m *web.Route) {
addWebhookAddRoutes := func() {
m.Get("/{type}/new", repo_setting.WebhooksNew)
- m.Post("/gogs/new", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksNewPost)
m.Post("/{type}/new", repo_setting.WebhookCreate)
}
addWebhookEditRoutes := func() {
- m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost)
m.Post("/{type}/{id:[0-9]+}", repo_setting.WebhookUpdate)
}