Adds an operator dashboard for self-hosters, gated on a passkey-
authenticated admin flag (ADMIN_UIDS env) and enforced server-side.
Backend:
- ADMIN_UIDS / INVITE_ONLY env (both off by default, OSS-friendly).
- Invite codes in db.json; /api/register gated when INVITE_ONLY, code
burned on successful signup.
- disabled users are rejected by readSession — locked out everywhere.
- /api/admin/{users,user,user/disable,invites,invites/new,invites/revoke}
behind an admin guard; /api/config exposes invite_only to the login UI.
- admin flag surfaced on /api/me, register/verify, login/verify.
Frontend:
- New /admin route + Settings link, shown only to admins: user list with
workout counts and last-sync, disable/enable, invite generation, and a
per-user workout-history drill-down.
- Registration sheet shows an invite-code field when the instance is
invite-only.
Phase 2 (live 'training now' via a heartbeat) is separate.
42 lines
2.1 KiB
Bash
42 lines
2.1 KiB
Bash
# Copy this file to ".env" and adjust for your setup, then: docker compose up -d
|
|
#
|
|
# ── Local testing (default) ────────────────────────────────────────────────
|
|
# Works out of the box on the machine running Docker. Open http://localhost:8080
|
|
RP_ID=localhost
|
|
ORIGIN=http://localhost:8080
|
|
WEB_PORT=8080
|
|
RP_NAME=openGym
|
|
|
|
# ── Real deployment behind your own HTTPS domain ───────────────────────────
|
|
# Passkeys are bound to the exact hostname, and browsers only allow them over
|
|
# HTTPS (localhost is the one exception). Put openGym behind a reverse proxy /
|
|
# tunnel that terminates TLS for your domain, then set:
|
|
#
|
|
# RP_ID=gym.example.com
|
|
# ORIGIN=https://gym.example.com
|
|
# WEB_PORT=8080
|
|
# RP_NAME=openGym
|
|
#
|
|
# (Point your proxy at the web container's WEB_PORT. See docs/SELF_HOSTING.md.)
|
|
|
|
# ── Admin dashboard & invite-only signup (optional) ────────────────────────
|
|
# Both off by default — a fresh instance has open signup and no admin.
|
|
#
|
|
# Make yourself an admin: register your own passkey profile first, find your
|
|
# user id in ./data/db.json ("users"[].id), then list it here (comma-separated
|
|
# for several admins). Admins get an "Admin dashboard" link in Settings to see
|
|
# users, disable accounts, generate invite codes and view workout history.
|
|
#
|
|
# ADMIN_UIDS=youruserid,anotheradmin
|
|
#
|
|
# Require an invite code to create new profiles (existing accounts keep working;
|
|
# generate the codes from the admin dashboard):
|
|
#
|
|
# INVITE_ONLY=1
|
|
|
|
# ── Notifications (optional) ───────────────────────────────────────────────
|
|
# Push works out of the box — nothing to set. VAPID keys are generated on first
|
|
# run and saved to ./data/vapid.json. Each user's browser reports its own
|
|
# timezone automatically, so the workout-day reminder fires at their local
|
|
# time regardless of where the server runs or where they're travelling.
|