Repository navigation
feat(alerts): installable PWA with Web Push notifications - #49
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Changes
VAPID_PRIVATE_KEYandVAPID_SUBJECToverride it)pushalert channel with per-rule recipientsPUSH_EXTRA_HOSTSadds more), no redirects, 20 devices per user0039_web_pushand0040_push_failing_sinceTest plan
go test ./...(testcontainers Postgres), including deterministic lock-order tests for register, rotate, logout, password and user deletegolangci-lint: 0 issuesvue-tscChecklist
Contributor License Agreement