mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
feat: add gitea/forgejo support
This commit is contained in:
parent
ace036c209
commit
aec0d1a257
43 changed files with 683 additions and 130 deletions
20
src/providers/gitea/index.ts
Normal file
20
src/providers/gitea/index.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import type { Env, WebhookEvent } from "../../types";
|
||||
import type { Provider } from "../types";
|
||||
import { verifyGiteaSignature } from "./verify";
|
||||
import { parseGiteaEvent } from "./parse";
|
||||
|
||||
export const giteaProvider: Provider = {
|
||||
id: "gitea",
|
||||
|
||||
matches(headers) {
|
||||
return headers["x-gitea-event"] !== undefined;
|
||||
},
|
||||
|
||||
async verify(body, headers, env: Env) {
|
||||
return verifyGiteaSignature(body, headers["x-gitea-signature"], env.GITEA_WEBHOOK_SECRET);
|
||||
},
|
||||
|
||||
parse(body, headers): WebhookEvent | null {
|
||||
return parseGiteaEvent(headers, body);
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue