Skip to content

feat(alerts): installable PWA with Web Push notifications - #49

Merged
bashgeek merged 3 commits into
mainfrom
feat/pwa-web-push
Nov 15, 2026
Merged

bashgeek merged 3 commits into
mainfrom
feat/pwa-web-push

Conversation

@bashgeek

Copy link
Copy Markdown
Contributor

Summary

Tindra can be installed to the home screen or desktop, and alert rules can notify chosen users on their devices through Web Push, without a relay service.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs / config only

Changes

  • Web Push encryption (RFC 8291) and VAPID (RFC 8292) on the standard library; the VAPID key is generated on first start (VAPID_PRIVATE_KEY and VAPID_SUBJECT override it)
  • push alert channel with per-rule recipients
  • Endpoints only on known push services (PUSH_EXTRA_HOSTS adds more), no redirects, 20 devices per user
  • Devices are dropped after 72h of device-side failures, only while their push service still delivers elsewhere; retries go only to devices that missed a firing
  • Password change, reset and logout remove devices; the service worker moves rotated subscriptions itself
  • Manifest, icons and a service worker without a fetch handler, so nothing is cached
  • Profile section to turn push on per device, recipient picker in the alerts tab
  • Migrations 0039_web_push and 0040_push_failing_since

Test plan

  • go test ./... (testcontainers Postgres), including deterministic lock-order tests for register, rotate, logout, password and user delete
  • golangci-lint: 0 issues
  • vitest (2502 passed) and vue-tsc

Checklist

  • Tests added or updated
  • No new dependencies introduced (or justified in the PR description)
  • I assign copyright in this contribution to Blendbyte GmbH, as required by the
    Contributor License Agreement

Tindra can be added to the home screen or desktop and alert rules can
notify people on their devices through Web Push, without a relay service.

- Web Push encryption (RFC 8291) and VAPID (RFC 8292) on the standard
  library, checked against the RFC 8291 test vector
- VAPID key generated on first start and stored in instance_secrets;
  VAPID_PRIVATE_KEY and VAPID_SUBJECT override it
- push alert channel with per-rule recipients; a firing counts as
  delivered once one device got it, gone devices are removed and
  devices failing 5 times in a row are dropped
- session-only /api/push endpoints to register, list, test and remove
  devices, with https and SSRF checks and a 20 device cap per user
- manifest, icons and a service worker without a fetch handler, so
  nothing is cached; notification clicks route inside the open app
- profile section to turn push on per device, explaining HTTPS, iOS
  home screen and blocked permission cases; logout unsubscribes
- push channel and recipient picker in the alerts tab and MCP tool
Delivery:
- Count only failures the push service blames on the device; drop a
  device after 72h of failures, and only while its push service still
  delivers elsewhere.
- Retry only the devices that missed a firing; a firing that reached
  some devices counts as delivered.
- Send in parallel with a per-firing timeout; shrink payloads to fit;
  no shared tag or topic between alerts.

Security:
- Accept endpoints only on known push services (PUSH_EXTRA_HOSTS adds
  more); never follow redirects or show push service responses.
- Endpoint takeover requires the subscription's keys.
- Password change, reset and admin set-password remove devices (the
  current one is kept on change); logout removes this browser's device.
- Hide rule recipients from API tokens and MCP; MCP cannot create push
  rules. Validate VAPID_SUBJECT at startup.

Consistency:
- One lock order across register, rotate, logout, password, user delete
  and rule save, with deterministic deadlock tests.
- Deleting a user pauses push rules left without recipients.
- Migration 0040 adds failing_since and a last_success_at index.

Browser:
- The service worker moves rotated subscriptions itself, retries, and
  parks moves while the server is down.
- No silent re-registration of removed devices; permission is asked
  before network calls; logout cleanup is time-capped.
- Recipient picker for push rules.
@bashgeek
bashgeek merged commit 6800dbe into main Nov 15, 2026
7 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.

1 participant