Commit Graph

20 Commits

Author SHA1 Message Date
Julien Calixte
1ce5d9150d feat(auth): require DID owner JWT to manage webhooks
Both POST /:did/webhooks and DELETE /:did/webhooks were unauthenticated:
anyone could register a webhook for someone else's DID (privacy leak)
or wipe a DID's webhook list (DoS on legitimate subscribers). Now both
endpoints require a Bluesky session bearer token, verified end-to-end
against the DID's PDS via the existing authenticateRequest helper, and
the verified DID must match the URL :did.
2026-05-05 12:27:22 +02:00
Julien Calixte
7b53909c52 feat(webhooks): add per-verb subscriptions and bulk-create debounce
Subscriptions now declare a `verb` (create | delete | bulk-create).
POST /:did/webhooks defaults to inserting both create and delete rows
when no verb is given, preserving existing all-events behavior. Update
events fold into the create verb. The new bulk-create verb debounces
creates per DID over 400 ms and delivers a `records` array.

Migration adds the verb column with default 'create' and clones every
existing row for the delete verb so legacy subscriptions keep firing
on both events.
2026-05-05 12:25:54 +02:00
Julien Calixte
92e0dbe0d4 feat: add GitHub OAuth proxy endpoint at /auth/github 2026-03-21 10:35:49 +01:00
Julien Calixte
282b797206 feat: add /health endpoint and Docker healthcheck 2026-03-17 02:21:24 +01:00
Julien Calixte
8c9ab34565 feat: add optional bearer token support for webhook subscriptions
Token is stored in the DB but never returned in API responses (write-only).
fireWebhooks() sends Authorization: Bearer <token> header when present.
2026-03-14 18:16:28 +01:00
Julien Calixte
06ac3142a8 feat: add POST /notes/feed endpoint for multi-DID filtering 2026-03-10 15:51:10 +01:00
Julien Calixte
373b7a6777 feat: add webhook_subscription table and CRUD endpoints
- Migration: CREATE TABLE webhook_subscription (id, did, method, url) with index on did
- db.ts: addWebhookSubscription and deleteWebhooksByDid helpers
- server.ts: POST /:did/webhooks (201) and DELETE /:did/webhooks (204)
2026-02-25 22:46:45 +01:00
Julien Calixte
c84b4c5f97 robustness: split jetstream into own container, add cursor persistence
Jetstream was running backgrounded in the same container as the API server,
so crashes went undetected and Docker never restarted it. Now each process
runs as a separate docker-compose service with independent restart policies.

Also adds cursor persistence to SQLite (saved every 5s) so restarts resume
from where they left off, moves event destructuring inside try/catch blocks,
and adds global unhandled error/rejection handlers for crash visibility.
2026-02-17 01:17:42 +01:00
Julien Calixte
d1afdd6499 prune: remove unused imports 2026-02-15 13:10:50 +01:00
Julien Calixte
e0e095f7e5 fix: deletion should come from pds events 2026-02-15 09:24:40 +01:00
Julien Calixte
efb78ff14e logs: add ISO timestamp to all log output 2026-02-15 08:59:37 +01:00
Julien Calixte
562a3b061f refacto: no magic numbers 2026-02-14 22:47:48 +01:00
Julien Calixte
a7a90ea075 feat: authenticate DELETE endpoint with AT Protocol identity
Verify the caller owns the DID by resolving their PDS via plc.directory
and validating the session token before allowing note deletion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:38:40 +01:00
Julien Calixte
51ea8a8f17 feat: implement delete note endpoint in server
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:28:30 +01:00
Julien Calixte
c44c2bac3f logs: add logs for jetstream 2026-02-13 20:14:12 +01:00
Julien Calixte
f5f02dbc6d feat: add CORS middleware to allow all origins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:33:47 +01:00
Julien Calixte
6e22fd2f56 feat: add endpoints to get notes 2026-02-09 14:07:17 +01:00
Julien Calixte
ed157cb4df lint: format and lint 2026-02-09 12:03:27 +01:00
Julien Calixte
55699f0727 feat: add a server for querying notes 2026-02-09 11:53:49 +01:00
Julien Calixte
d677ed24c3 chore: migrate to deno 2026-02-09 10:28:12 +01:00