summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authoroliverpool <git@olivier.pfad.fr>2024-03-21 14:04:37 +0100
committeroliverpool <git@olivier.pfad.fr>2024-03-27 15:38:39 +0100
commitdce754cde180903d349fbca611ec1b8ab90ea5e2 (patch)
treeeff87b97519ea71538daa365fcb8488fc2fbcad1 /routers
parent[REFACTOR] webhook wechatwork endpoint (diff)
downloadforgejo-dce754cde180903d349fbca611ec1b8ab90ea5e2.tar.xz
forgejo-dce754cde180903d349fbca611ec1b8ab90ea5e2.zip
[REFACTOR] webhook packagist endpoint
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/setting/webhook.go26
-rw-r--r--routers/web/web.go2
2 files changed, 0 insertions, 28 deletions
diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go
index a1021c1967..ea36da649f 100644
--- a/routers/web/repo/setting/webhook.go
+++ b/routers/web/repo/setting/webhook.go
@@ -388,32 +388,6 @@ func gogsHookParams(ctx *context.Context) webhookParams {
}
}
-// PackagistHooksNewPost response for creating Packagist webhook
-func PackagistHooksNewPost(ctx *context.Context) {
- createWebhook(ctx, packagistHookParams(ctx))
-}
-
-// PackagistHooksEditPost response for editing Packagist webhook
-func PackagistHooksEditPost(ctx *context.Context) {
- editWebhook(ctx, packagistHookParams(ctx))
-}
-
-func packagistHookParams(ctx *context.Context) webhookParams {
- form := web.GetForm(ctx).(*forms.NewPackagistHookForm)
-
- return webhookParams{
- Type: webhook_module.PACKAGIST,
- URL: fmt.Sprintf("https://packagist.org/api/update-package?username=%s&apiToken=%s", url.QueryEscape(form.Username), url.QueryEscape(form.APIToken)),
- ContentType: webhook.ContentTypeJSON,
- WebhookForm: form.WebhookForm,
- Meta: &webhook_service.PackagistMeta{
- Username: form.Username,
- APIToken: form.APIToken,
- PackageURL: form.PackageURL,
- },
- }
-}
-
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 81ff59499d..4b44a8eac5 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -403,13 +403,11 @@ 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("/packagist/new", web.Bind(forms.NewPackagistHookForm{}), repo_setting.PackagistHooksNewPost)
m.Post("/{type}/new", repo_setting.WebhookCreate)
}
addWebhookEditRoutes := func() {
m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost)
- m.Post("/packagist/{id}", web.Bind(forms.NewPackagistHookForm{}), repo_setting.PackagistHooksEditPost)
m.Post("/{type}/{id:[0-9]+}", repo_setting.WebhookUpdate)
}