Release v1.2.9: Aktivitaetslog im Admin-Dashboard, Demo wieder online

Wer sich anmeldet, wer es vergeblich versucht und was ein Admin aendert, stand
bisher nirgends — der Server hat schlicht nichts protokolliert.

Aktivitaetslog:
- ./data/audit.log, eine JSON-Zeile pro Event, angehaengt statt neu geschrieben.
  Bewusst NICHT in db.json: die Datei wird bei jedem Save komplett neu geschrieben,
  und der Login-Handshake ist unauthentifiziert — ein Log darin haette aus einem
  Muell-Request einen vollen Rewrite gemacht.
- Aufbewahrung ist eine Obergrenze, kein Archiv: AUDIT_MAX (5000) bzw. AUDIT_DAYS (90).
- Per Default an (AUDIT_LOG=0 schaltet es ganz ab). IP-Adressen per Default AUS;
  AUDIT_IP=net speichert nur das Netz, full die ganze Adresse. Nie der User-Agent,
  nie die Passkey-ID eines Fehlversuchs, nie ein abgelehnter Invite-Code.
- Adresse kommt aus CF-Connecting-IP, dann X-Forwarded-For, dann X-Real-IP —
  ein Cloudflare-Tunnel schreibt den Besucher NICHT in XFF, dort steht sonst nur
  der Tunnel selbst und sieht dabei voellig plausibel aus.
- Loeschen wird selbst protokolliert, die Event-IDs zaehlen weiter: die Luecke bleibt sichtbar.
- Neue Karte in views/Admin.jsx (Filter, "Show more"), Aufbereitung in lib/audit.js
  mit 20 Tests. GET /api/admin/audit und POST /api/admin/audit/clear, beide hinter requireAdmin.

Demo:
- Die Live-Demo laeuft wieder, jetzt auf der Projektseite selbst statt auf GitHub Pages:
  opengym.duarte-santos.ch/demo/. Das eingebettete Telefon auf der Startseite geht damit auch
  wieder — es muss derselbe Host sein, X-Frame-Options ist SAMEORIGIN.

Doku: README-Config-Tabelle, .env.example, SELF_HOSTING, SECURITY (inkl. der
api/server.js-Zeilenverweise, die wieder stimmen).
This commit is contained in:
Duarte Santos committed 2026-08-23 16:12:35 +02:00
1 parent e709f152c8
commit 8b99a644ed
17 files changed
+658 -67

No files matched your search

+5
View File
@@ -9,6 +9,11 @@ Not in this folder (added at deploy time):
- `icon-180.png` / `icon-512.png` — copied from `../frontend/public/` (the same
icons the PWA uses, so the browser tab, home screen and app all match)
- `openGym.apk` — the signed release build (see `../docs/MOBILE.md`)
- `demo/` — the browser-only demo build of the app, embedded in the `#demo` section and
reachable on its own at `/demo/`. Built from `../frontend` with `VITE_DEMO=1` and the
jsDelivr media bases (see the recipe in `../.github/workflows/pages.yml`), so the ~140 MB
of exercise media stays out of it. It has to live on this host: the site frames it, and
`X-Frame-Options: SAMEORIGIN` would block it from anywhere else.
`site.js` fetches the star/issue counts and the release timeline from the public
gitea.com API at view time. It pointed at api.github.com until that account was