Push notifications: period soon/late reminders, test button

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-18 09:43:41 +01:00
parent ce66b857db
commit bb19bc0aeb
12 changed files with 872 additions and 21 deletions

View file

@ -26,6 +26,25 @@ boundary.
The logic lives in `static/cycle.js` and is tested in `tests/test_cycle.js`.
## Notifications
Web Push, sent by `notify.js` (Node, no dependencies: built-in crypto and
SQLite). It reuses `static/cycle.js`, so reminders always match the app.
- `flowtrack-notify daily` runs once a day. It sends "period expected soon"
once per cycle, `remindDays` (1-7, default 2) before the predicted start,
and "period is late" once per cycle after the expected day passes.
- The owner turns notifications on per device in Settings, where there is
also a test button. On iPhone this only works from the Home Screen app
(iOS 16.4 or later).
- The VAPID key pair is created on first start and stored in the database.
Replacing it invalidates every subscription.
- The server only accepts subscriptions on Apple, Google, Mozilla and
Microsoft push hosts, because it POSTs to whatever endpoint it stores.
Enable it with `--push-contact https://your.site` (the NixOS module does
this through `push.contact`).
## Access
Nginx must overwrite `Remote-User` with the Authelia username. Users listed
@ -49,6 +68,8 @@ services.flowtrack = {
editors = [ "kayla" ];
viewers = [ "fred" ];
backup.directory = "/mnt/disk2/backups/flowtrack"; # nightly, keeps 30
push.contact = "https://flowtrack.example.org";
push.time = "*-*-* 09:00:00 Europe/London";
};
```