mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-27 04:21:11 +00:00
[BRANDING] define the forgejo webhook type
templates/swagger/v1_json.tmpl updated with `make generate-swagger` (cherry picked from commit88899c492e) (cherry picked from commit7171bd9617) (cherry picked from commit1a742446c1) (cherry picked from commitd7c189d7b2) Conflicts: routers/web/web.go (cherry picked from commitcbdea868e4) (cherry picked from commit6cd150483b) (cherry picked from commit47246da8d3) (cherry picked from commitf2aa0e6b76) (cherry picked from commit5a4fc69a16) (cherry picked from commit48e444ca09) (cherry picked from commit888e537811) (cherry picked from commit5121f493c9)
This commit is contained in:
parent
a55a9567d3
commit
9394e55fdf
14 changed files with 127 additions and 12 deletions
|
|
@ -307,6 +307,34 @@ func editWebhook(ctx *context.Context, params webhookParams) {
|
|||
ctx.Redirect(fmt.Sprintf("%s/%d", orCtx.Link, w.ID))
|
||||
}
|
||||
|
||||
// ForgejoHooksNewPost response for creating Forgejo webhook
|
||||
func ForgejoHooksNewPost(ctx *context.Context) {
|
||||
createWebhook(ctx, forgejoHookParams(ctx))
|
||||
}
|
||||
|
||||
// ForgejoHooksEditPost response for editing Forgejo webhook
|
||||
func ForgejoHooksEditPost(ctx *context.Context) {
|
||||
editWebhook(ctx, forgejoHookParams(ctx))
|
||||
}
|
||||
|
||||
func forgejoHookParams(ctx *context.Context) webhookParams {
|
||||
form := web.GetForm(ctx).(*forms.NewWebhookForm)
|
||||
|
||||
contentType := webhook.ContentTypeJSON
|
||||
if webhook.HookContentType(form.ContentType) == webhook.ContentTypeForm {
|
||||
contentType = webhook.ContentTypeForm
|
||||
}
|
||||
|
||||
return webhookParams{
|
||||
Type: webhook_module.FORGEJO,
|
||||
URL: form.PayloadURL,
|
||||
ContentType: contentType,
|
||||
Secret: form.Secret,
|
||||
HTTPMethod: form.HTTPMethod,
|
||||
WebhookForm: form.WebhookForm,
|
||||
}
|
||||
}
|
||||
|
||||
// GiteaHooksNewPost response for creating Gitea webhook
|
||||
func GiteaHooksNewPost(ctx *context.Context) {
|
||||
createWebhook(ctx, giteaHookParams(ctx))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue