Add push notifications: rest-timer alert + workout-day reminder

Web Push (VAPID) backend: keys auto-generated on first run, per-user
subscriptions, one new dependency (web-push). The rest timer schedules
a server-side push on start/extend and cancels it on skip or on-screen
completion, so it only actually fires if the tab got suspended before
finishing. A per-minute check sends an optional daily reminder on days
with a planned routine that hasn't been logged yet.

Opt in per-profile in Settings — requires a signed-in passkey profile.
This commit is contained in:
Duarte Santos committed 2026-07-21 11:07:10 +02:00
1 parent 84c59129e3
commit 4c2b6344f7
11 files changed
+448 -7

No files matched your search

+19 -1
View File
@@ -99,7 +99,23 @@ tar czf opengym-backup-$(date +%F).tar.gz data/
That archive contains all profiles, passkeys and workout history. Restore by unpacking it back
into the project folder. (Individual users can also export their own data as JSON from Settings.)
## 6. Updating
## 6. Notifications
openGym can push two kinds of alert to your phone/desktop, even when the app isn't open:
rest-timer-over, and a reminder on days you have a workout planned but haven't logged one yet.
Turn it on per-profile in **Settings → Notifications** (requires a signed-in passkey profile and
HTTPS — see section 3).
No setup needed server-side: VAPID keys are generated on first run and saved to `./data/vapid.json`.
The one thing worth setting is your timezone, so the day reminder fires at the time you actually
picked rather than UTC:
```bash
# .env
TZ=Europe/Zurich
```
## 7. Updating
```bash
git pull
@@ -117,4 +133,6 @@ downloaded media are untouched.
| "verification failed" on login | `RP_ID`/`ORIGIN` don't match the URL in the address bar. Make them exact, restart. |
| Media didn't download | `docker compose logs media`. Re-run `docker compose up -d`, or run `./scripts/fetch-media.sh`. |
| Port 8080 already used | Set `WEB_PORT=9090` in `.env` (and update `ORIGIN` for local testing). |
| No "Notifications" option in Settings | Requires a signed-in profile and HTTPS (or `localhost`) — guest mode and plain HTTP over LAN can't subscribe. |
| Day reminder fires at the wrong time | Set `TZ=Continent/City` in `.env` and restart (see section 6). Defaults to UTC. |
| Want to reset a stuck login | Delete the cookie in your browser; sessions are just signed cookies. |