feat(webhooks): add admin endpoint to list every subscription

Adds GET /admin/webhooks gated by an ADMIN_DIDS env-var allowlist of
verified AT Proto DIDs. Fail-closed: if ADMIN_DIDS is unset, the route
always returns 403 — no accidental exposure on deploys that forget it.
This commit is contained in:
Julien Calixte
2026-05-05 14:07:22 +02:00
parent c00f3d631c
commit 34faa10be2
2 changed files with 38 additions and 0 deletions

View File

@@ -136,6 +136,12 @@ export const listWebhooksByDid = (
).all<Omit<WebhookSubscriptionRow, "token">>(did);
};
export const listAllWebhooks = (): Omit<WebhookSubscriptionRow, "token">[] => {
return db.prepare(
"SELECT id, did, method, url, verb FROM webhook_subscription ORDER BY did, id",
).all<Omit<WebhookSubscriptionRow, "token">>();
};
export const getWebhooksByDidAndVerb = (
did: string,
verb: WebhookVerb,