8 Commits

Author SHA1 Message Date
Julien Calixte
6760c434b4 refactor(db): lazy-init connection and add test seam
The Database handle is now constructed on first use and held in
a module-level slot. New _setDbForTest and _resetDbForTest
exports let tests swap in a :memory: handle without rewriting
callers. closeDb() replaces the previous db.close() pattern used
by short-lived scripts. Adds listDistinctNoteDids() to keep the
backfill script from poking the raw connection.
2026-06-07 22:04:12 +02:00
Julien Calixte
d7e189c61f feat(scripts): add OpenSearch backfill task
Iterates distinct DIDs in SQLite, resolves each one's PDS, and reindexes
every space.remanso.note record into OpenSearch via
com.atproto.repo.listRecords. Needed because note content is not
persisted to SQLite, so the index would otherwise only cover notes
created after deployment.
2026-06-07 11:26:20 +02:00
Julien Calixte
355fc45316 refactor(scripts): switch webhooks:all to api fetch
Hits GET /admin/webhooks instead of opening the local SQLite directly,
so the task can be run from a developer laptop without ssh or file
access to the server. Drops the FFI/read/write task permissions in
favour of net/env.
2026-05-05 14:07:31 +02:00
Julien Calixte
1c160b6c53 refactor(scripts): extract atproto session helpers to shared module 2026-05-05 14:07:26 +02:00
Julien Calixte
c00f3d631c chore(scripts): add admin task to list every webhook
Direct SQLite read with no DID filter — complements the API-backed
`webhooks list`, which is scoped per DID.
2026-05-05 14:00:10 +02:00
Julien Calixte
5cb581123d chore(scripts): add list and delete commands to manage-webhooks
`deno task webhooks list` prints the authenticated DID's subscriptions
(id, url, method, verb). `deno task webhooks delete --id <id>` removes
a single one — pair with `list` to pick which to drop instead of
nuking everything via delete-all.
2026-05-05 12:38:32 +02:00
Julien Calixte
a3c92254ea refactor(scripts): auto-resolve PDS from handle, drop BSKY_PDS
Inputs are now just ATPROTO_HANDLE, ATPROTO_APP_PASSWORD, REMANSO_API
(or matching --handle, --app-password, --api). The script resolves the
handle to a DID via public.api.bsky.app, then resolves the DID to a
PDS via plc.directory — same path the server's verifier uses. Works
for any AT Protocol PDS (Bluesky, eurosky, self-hosted) without the
caller having to know the PDS URL.
2026-05-05 12:36:22 +02:00
Julien Calixte
e0fe4ce16f chore(scripts): add deno task webhooks for register and delete-all
Wraps the createSession + Authorization: Bearer flow so callers don't
need to assemble curl by hand. Reads BSKY_IDENTIFIER / BSKY_PASSWORD /
BSKY_PDS / REMANSO_API from env (or matching flags). Defaults to
bsky.social so non-bsky-hosted accounts must set BSKY_PDS explicitly,
e.g. BSKY_PDS=https://eurosky.social.
2026-05-05 12:32:43 +02:00