feat: add gitea/forgejo support

This commit is contained in:
RhenCloud 2026-08-11 22:01:04 +08:00
parent ace036c209
commit aec0d1a257
43 changed files with 683 additions and 130 deletions

View file

@ -40,6 +40,17 @@ export function groupAcceptsOwners(group: Group, owners: string[]): boolean {
return seen.some((o) => restrict.includes(o));
}
/**
* Whether an event from a webhook `provider` (source platform: github, gitea,
* ...) is allowed into this group. A group with no provider restriction
* accepts every provider. Events without a provider are treated as github.
*/
export function groupAcceptsProvider(group: Group, provider?: string): boolean {
const allowed = (group.providers ?? []).map((s) => s.trim().toLowerCase()).filter(Boolean);
if (allowed.length === 0) return true;
return allowed.includes(provider ?? "github");
}
export interface AccessScope {
isSuper: boolean;
/** Groups the user may view/edit. When isSuper, this is every group. */