Skip to content

01a051f7 - Add self-hosted Web Push with VAPID and an outbox worker - #67

Merged
TaprootFreak merged 13 commits into
developfrom
01a051f7-web-push
Aug 30, 2026
Merged

01a051f7 - Add self-hosted Web Push with VAPID and an outbox worker#67
TaprootFreak merged 13 commits into
developfrom
01a051f7-web-push

Conversation

@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

EN:
The api stores Web Push subscriptions on the account and sends transactional forum and zap notifications itself. Missing VAPID keys still boot the process; those routes return 503. No third-party push SDK.

DE:
Die API speichert Web-Push-Abos am Account und schickt Forum- und Zap-Nachrichten selbst. Fehlen die VAPID-Schlüssel, bootet der Prozess weiter; die Routen antworten 503. Kein Drittanbieter-SDK.

Details

Self-hosted Web Push (RFC 8030 / VAPID). New tables push_subscription and push_outbox. Worker sends when VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY are set (VAPID_SUBJECT defaults to https://21.gifts).

HTTP:

  • GET /push/vapid-public (Bearer)
  • POST / DELETE /me/push-subscriptions (Bearer)
  • POST /debug/push-ping (DEBUG_TOKEN)

Enqueue:

  • Forum post → every other account with a subscription (tag: forum)
  • Newly indexed zap → note author

Secret columns endpoint, p256dh, and auth are hashed in db_change like view_key.

Deploy: put the VAPID private key in the secret store; the public key is not a secret. The process does not fail boot if they are unset.

@TaprootFreakAI
TaprootFreakAI force-pushed the 01a051f7-web-push branch 2 times, most recently from 376afbc to d34d0a5 Compare August 30, 2026 13:48
Store browser subscriptions on the account, enqueue forum and zap
notifications, and send them when VAPID is configured. Missing keys
keep the process booting; push HTTP returns 503.
Missing keys already returned 503. Garbage keys used to throw inside
web-push during sender construction and would take down the process.
Validate decoded lengths and subject, and catch constructor throws.
Passing undefined into the helper still applied the configured default,
so POST returned 200 and DELETE 404 instead of 503.
Default e2e boot already sets DEBUG_TOKEN, so an unauthenticated
debug-ping is 401. Blank VAPID env so host keys cannot leak into the
booted process.
…edAt

Boot now passes an explicit empty public key so createApp cannot pick
VAPID back up from the environment after a sender throw. Subscription
upsert returns the persisted createdAt, including rebinds.
Forum and zap ingest now have tests for enqueue throws. The worker
tick marks sent or failed without an unreachable else. Document
upsert return values.
messagesRoutes handbook and TSDoc now mention optional pushStore.
Prettier the env table after merging develop.
Empty/invalid base64, non-numeric push status codes, and Date leases
are tested. The interval will not start a second tick until the first
has settled.
The null-lease case must stay null. Map a Date lease in its own test
so v8 covers the instanceof Date branch.
Postgres mappers now see both Date and ISO string created_at.
createApp without vapidPublicKey still reads a valid env pair.
createdAt of 1 was expired and evicted, so the request returned 401.
@TaprootFreakAI

Copy link
Copy Markdown
Collaborator Author

EN:
Ready after 5 review passes.
The api stores Web Push subscriptions and sends forum and zap notifications itself.

DE:
Bereit nach 5 Review-Durchläufen.
Die API speichert Web-Push-Abos und schickt Forum- und Zap-Nachrichten selbst.

Details

Grok quality and logic reached 0 findings. CI is green on this head and the PR is mergeable. Mixed-device retry of a successful endpoint after a sibling failure is the leftover, for a later PR if Codex or operators want it. Codex review itself was deferred to a follow-up PR.

@TaprootFreakAI
TaprootFreakAI marked this pull request as ready for review August 30, 2026 14:22
@TaprootFreak
TaprootFreak merged commit 9c063fb into develop Aug 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants