99 Commits
Author SHA1 Message Date
Duarte Santos 4a9e1e3456 Merge main (v1.2.11) into coach: Pairing, Notizen, Aufwaerm-Saetze, GitLab-CI
Der Coach-Zweig stand seit v1.2.7. Konflikte: beide Seiten behalten (Server-Imports,
Store-Felder, Home-Titel mit naechster Einheit, history.js), das Dockerfile behaelt seine
zwei Targets und kopiert die neuen Server-Module mit, compose zeigt auf die GitLab-Registry.
pt-BR: die 139 Coach-Strings in die Sie-Form gebracht, Fingerprint nachgezogen.
2026-08-29 17:03:39 +02:00
Duarte Santos a710a432be Coach: eigene Uebungen duerfen benannt werden, und was der Validator sonst noch durchliess
Die Custom-Uebungen des Nutzers standen im Library-Slice, den das Modell bekam,
wurden vom Validator aber abgelehnt — jeder Vorschlag, der eine nannte, verbrannte
die einzige Reparaturrunde. Dazu: __proto__-IDs, Gewichts- und Tempo-Obergrenzen,
doppelte Uebungen und doppelte Change-IDs, routineName auf jeder Aenderung, und
ein Gewicht fuer eine nie gehobene Uebung wird verworfen statt geraten.
2026-08-29 16:57:33 +02:00
Duarte Santos bc3ac09c77 release: v1.2.11
Versions in both package.json files, the lockfile's two self-references and the
Android build (versionCode 11 -> 12, so the APK installs over the last one).
The website's download line goes from v1.2.9 to v1.2.11 — it had been left
behind by the previous release as well.

Changelog covers the six defects found reviewing v1.2.10, the two merge requests
from mflova, and the landing page.
2026-08-25 22:08:15 +02:00
Duarte Santos 69cefca19e release: v1.2.10
Version bumped in both package.json files, the lockfile's self-reference and
the Android build (versionCode 10 -> 11, so the APK installs over the last
one). Changelog covers everything since v1.2.9 in one entry, per the
project's versioning rule.
2026-08-25 20:02:28 +02:00
Duarte Santos 6ea7526bff api + docs: say what went wrong when RP_ID or ORIGIN does not match
@simplewebauthn reports a mismatch as "Unexpected RP ID hash", which tells a
self-hoster nothing about their own .env — and this is the most common support
question in #install-help, where charliebelt is currently stuck behind a
Cloudflare Tunnel with values that look right. The error now names both
configured values back and points at the docs. Neither is a secret: one is the
address bar, the other its hostname.

Extracted as api/verify-error.js so it can be tested without booting a server
that opens files and a port, following push-messages.js.

SELF_HOSTING.md gets the diagnosis in order: read what the server logged on
startup (it prints rpID and origin, and `docker compose restart` does not
re-read .env), then the exact shape of each value as a table, then the
reverse-proxy case, then www., then that changing the hostname invalidates
existing passkeys. Plus the thing adam934912 called a blocker: on a LAN
without certificates there is nothing to configure that makes passkeys work.
2026-08-25 20:00:10 +02:00
Duarte Santos 7d2460c2c2 Merge merge request !20 (intensifiers, pairing, theme, security hardening)
Takes the nine commits as submitted, with three adjustments:

- remote.test.js ran in the node environment while remote.js pulls in
  api.js, which reads navigator.userAgent at module scope — the file failed
  to import. Same @vitest-environment happy-dom pragma the api tests use.
- Drops skills-lock.json. It pins a personal Claude Code skill chain to
  third-party GitHub repos by hash; that is contributor tooling, not a
  project artefact, and this project's GitHub access is gone. CLAUDE.md
  itself is kept — it is an accurate description of the repo.
- Corrects two stale claims in that CLAUDE.md: the website deploys from
  .gitlab-ci.yml, not GitHub Pages, and the CI gate is GitLab, not Gitea
  Actions with a dormant GitHub copy.

pt-BR: 23 of the 44 new pt strings are European (ficheiro, telemóvel,
Definições, «guillemets», tu-forms), so they get Brazilian overrides
rather than being inherited; fingerprint re-baselined.
2026-08-25 14:28:10 +02:00
JoseviandClaude Opus 5 e326f1b1cb api: cierra SSRF en push, CSRF por subdominio hermano y shadowing de cookie
Cuatro problemas encontrados en una revision de seguridad, los cuatro reproducidos
antes y despues del arreglo.

SSRF + cuelgue del handler. El `endpoint` de una suscripcion push se validaba solo
como "string no vacio", y web-push lo pasa tal cual a https.request: cualquier
usuario registrado alcanzaba cualquier host:puerto que viera el contenedor api,
que comparte red Docker con el resto del stack. Ademas no habia timeout, asi que
un endpoint que aceptaba TCP y se callaba dejaba colgado el handler que hacia
await (>2 min medidos). Ahora el rechazo de direcciones loopback/privadas/
link-local/CGNAT vive en el lookup del propio agente, no en una pasada previa, asi
que no queda ventana de DNS rebinding; y los envios llevan timeout de 10s.

Amplificacion. No habia tope de suscripciones por usuario y sendPush lanzaba un
Promise.all sin limite: una peticion de ~90 bytes producia 200 conexiones TLS
simultaneas al host que eligiera el atacante. Cap de 20 por cuenta y 6 en vuelo.

CSRF. SameSite=Lax deja fuera un origen cross-site pero no un subdominio hermano,
que es el mismo site y es el reparto habitual en self-hosting; y el body se
parseaba como JSON dijera lo que dijera el Content-Type, asi que bastaba un POST
simple sin preflight. Ahora una peticion que cambia estado tiene que ser
Sec-Fetch-Site: same-origin, o traer un Origin igual a ORIGIN donde esa cabecera
no llegue. Exentas las rutas que llevan su credencial en el body y todo lo
autenticado por Bearer, para no romper la app movil.

Fijacion de sesion. Las cookies se reducian con Object.fromEntries, que se queda
con la ultima repetida: un subdominio hermano podia plantar gymsid para el dominio
padre y quedarse con la sesion. En HTTPS la cookie pasa a __Host-gymsid, que el
navegador garantiza host-only; la legacy se sigue aceptando, asi que actualizar no
desloguea a nadie. Un nombre repetido con valores distintos se rechaza entero.

El proxy de Vite reescribe Origin porque el dev server vive en otro puerto.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 10:01:07 +02:00
JoseviandClaude Sonnet 5 781e2441ba mobile: modo "conectar a mi servidor" (emparejamiento por codigo, sin passkeys)
La app movil puede ahora sincronizar de verdad contra un servidor openGym
propio en vez de guardar todo solo en el telefono. Como las passkeys no
funcionan desde el WebView de la app (su origen nunca coincide con el
hostname real), el emparejamiento se hace con un codigo de un solo uso
generado desde una sesion ya logueada en el navegador (Ajustes > "Emparejar
la app movil"), canjeado por un bearer token con la misma firma que ya usa
la cookie de sesion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 07:59:12 +02:00
mzspicoli 032fe1a348 fix(push): localize server notifications in pt-BR 2026-08-24 18:02:35 +02:00
Duarte Santos 925190109f Umzug nach GitLab: CI/CD fuer Tests, Images, APK, Pages und Releases
gitea.com hat keinen Actions-Runner, also gab es dort seit dem Umzug weder
Container-Images noch einen gebauten APK noch gruene Tests auf Merge Requests.
GitLab kann alles vier, also zieht das Projekt dorthin um.

.gitlab-ci.yml deckt die komplette Kette ab:
- test: Frontend-Suite (346 Tests), Locale-Checks, Fatigue-Probe, MCP-Suite
- build: api- und web-Image nach registry.gitlab.com/duartesantos8/opengym/*,
  auf v*-Tags amd64+arm64 mit latest/X.Y/X.Y.Z, sonst amd64 als edge
- package: signierter APK (zipalign + apksigner) plus Upload in die Generic
  Package Registry; der Key liegt in geschuetzten CI-Variablen und existiert
  damit nur auf main und v*-Tags
- deploy: der Browser-Demo-Build auf GitLab Pages
- release: GitLab-Release mit dem passenden CHANGELOG-Abschnitt und Links auf
  APK und Images

GitHub konnte "Tag gepusht" von "Release veroeffentlicht" unterscheiden und hat
Images nur aus letzterem gebaut (Issue #87). GitLab kann das nicht - dort ist die
Tag-Pipeline das, was das Release anlegt. Die Regel steht deshalb als Kommentar
im CI-File, und v*-Tags sind geschuetzt.

Ausserdem: Issue-/MR-Vorlagen unter .gitlab/, und saemtliche Repo-Links in
README, Docs, App, Dockerfile-Labels, docker-compose und Website zeigen auf
GitLab. site.js liest Sterne und Releases jetzt aus der GitLab-API (andere
Feldnamen, deshalb neue sessionStorage-Keys). SECURITY.md hat wieder einen
privaten Meldeweg: ein vertrauliches Issue.

.github/ und .gitea/ bleiben liegen - Spiegel bzw. fuer den Tag, an dem das
GitHub-Konto zurueckkommt.
2026-08-23 20:10:07 +02:00
Duarte Santos 8b99a644ed 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).
2026-08-23 16:12:35 +02:00
Duarte Santos c2e41937cb Release v1.2.8: Umzug nach gitea.com, Android-Back-Geste, Medien-Lizenz, Umami
Die Sammelversion fuer alles seit v1.2.7: der Umzug nach gitea.com (Images,
Klon-URL, Anlaufstellen, CI), die Zurueck-Geste auf Android via @capacitor/app,
die richtiggestellte Medien-Lizenz und die Umami-Zaehlung auf der Website (im
Frontend nur, wenn beim Build gesetzt -- selbstgehostet bleibt telemetriefrei).

api/package.json auf 1.2.8 nachgezogen; frontend/package.json und
android/build.gradle standen schon auf 1.2.8.
2026-08-22 15:32:04 +02:00
Duarte Santos f94fa7c0e3 Umzug nach gitea.com: Images, Klon-URL, Anlaufstellen und CI umgestellt
Das GitHub-Repo ist mit dem gesperrten Account weg, mit ihm die GHCR-Images, die
Pages-Demo und die Discussions. Alles, was jemand zum Selbsthosten anklickt, zeigte
aber weiter dorthin.

- docker-compose zieht jetzt gitea.com/duartesantos/opengym-{api,web}; die
  Dockerfile-Labels (source/url/documentation) ebenso
- README, SECURITY, CONTRIBUTING und docs/SELF_HOSTING zeigen auf gitea.com.
  Discussions gibt es dort nicht: Fragen und Ideen laufen als gelabelte Issues,
  Security-Meldungen ueber eine Issue-Anfrage nach einem privaten Kanal statt
  ueber GitHubs Advisories
- Badges auf die Gitea-Shields umgestellt, die tote Pages-Demo aus dem Kopf
  genommen (die APK bleibt der Weg zum Ausprobieren)
- .gitea/workflows: Tests und Docker-Publish, weiter mit Release- statt
  Tag-Trigger. Kein type=gha-Cache, den gibt es auf den Gitea-Runnern nicht;
  der Push braucht ein Repo-Secret PACKAGES_TOKEN mit write:package
- .gitea/ISSUE_TEMPLATE mit denselben Formularen wie auf GitHub
- .github/* bleibt unangetastet, falls der Account zurueckkommt

Die alten Issue-/PR-Nummern im CHANGELOG bleiben als reiner Text stehen - sie
zeigen auf ein totes Repo und passen nicht auf die Nummerierung hier.
2026-08-22 13:54:26 +02:00
Duarte Santos 4cd6f4d26c Merge remote-tracking branch 'origin/main' into coach
# Conflicts:
#	docs/SELF_HOSTING.md
2026-08-18 23:21:07 +02:00
Duarte Santos 5fb237682b Coach: der Fall ohne Vorgeschichte, und was der Validator durchgelassen hat
common.md wird jedem Prompt vorangestellt, also galt Regel 5 -- "jede
Begruendung nennt das, was in ihren Daten dafuer sprach" -- auch beim ersten
Plan fuer jemanden, der noch nichts geloggt hat. Da gibt es nichts zu nennen,
und die Regel hat das Modell genau dorthin gedraengt, wo es sich etwas
ausdenkt. Neu steht dabei, worauf man sich stattdessen beruft: Ziel, Erfahrung,
Tage, Ausruestung, Einschraenkungen -- und dass ein fehlendes window kein
Fehler ist. review.md sagt jetzt ausserdem, dass ohne Sessions die ehrliche
Antwort nochange ist, statt einen Grund zu erfinden.

repsMax stand im Validator, aber in keiner Tabelle -- das Modell konnte einen
Typ nicht verwenden, den wir akzeptieren.

payload.js laesst history ganz weg, wenn nichts mit Gewicht geloggt ist. Damit
lief die FR-20-Deckelung ins Leere und ein erfundenes Startgewicht ging
unveraendert an einen Anfaenger durch. Ohne Vergleichswerte fliegt weight jetzt
raus; die erste Session setzt die Basis, so wie create.md es ohnehin verspricht.

Dazu vier Luecken, die alle dieselbe Form haben -- etwas wird gezaehlt oder
gesetzt, aber nicht auf Eindeutigkeit geprueft:

- Zwei Routinen mit derselben id: known ist ein Set, die Woche validierte,
  ohne dass feststand, welche der beiden gemeint ist.
- Dieselbe Uebung zweimal in einer Routine: danach ist jedes reorder
  unerfuellbar (es verlangt jede id genau einmal) und jede gezielte Aenderung
  trifft die erste Kopie.
- Eine leere Woche uebersprang die Tagesanzahl-Pruefung ganz: "vier Tage" wurde
  mit einem Plan beantwortet, der gar nichts einplant.
- inc war nach oben offen.

add-routine trug ausserdem repsMin, prog und inc nicht mit, obwohl der
Bundle-Pfad sie kennt.

Die drei Codex-Flags sind aus invoke() in ein exportiertes argvFor()
gewandert und werden jetzt beim Wert geprueft. Sie waren vorher nirgends
getestet -- eines davon zu loeschen war ein gruener Build.
2026-08-18 23:20:05 +02:00
Duarte Santos 9007aeefb6 Release v1.2.7: compose reicht BACKEND/NGINX_PORT/PORT durch, Doku und Website nachgezogen, neue Screenshots 2026-08-18 15:33:02 +02:00
Duarte Santos 8d3f667c89 Merge main into coach: v1.2.6 plus die Backlog-Runde, Locale-Union, CI laeuft jetzt auch auf coach 2026-08-18 12:17:12 +02:00
Duarte Santos 32c9a2380d Healthchecks: 127.0.0.1 statt localhost, konfigurierter Port statt 80, /api/health statt /api/config 2026-08-18 11:50:53 +02:00
Georgiy Sitnikov 0e00e1029c Add version metadata and update Dockerfile labels for API and web services 2026-08-14 11:29:23 +02:00
Georgiy Sitnikov 011a3f7790 Add healthcheck to Dockerfiles for API and web services 2026-08-14 11:28:09 +02:00
AlexandClaude Opus 5 ef61df50f2 Coach: the Codex provider, and a credential that stays out of your backups
The Codex CLI adapter, its runtime and sandbox in the coach image only, and the
one placement decision this PR exists to get right.

Codex keeps a refreshable sign-in cache of its own rather than taking a token on
the environment, so it needs somewhere durable to write. That is ./coach-auth —
a sibling of ./data, never a folder inside it, mounted separately, owned by
`coach`, mode 0700.

The placement is the point. docs/SELF_HOSTING §5 tells owners to back up with
`tar czf … data/`, so anything under ./data lands in every archive people are
instructed to produce. Workout history belongs there; a live refresh token does
not — it keeps working after that archive is copied to a laptop or a cloud
drive. Keeping the cache outside ./data is what lets the backup instructions
stay true about what they capture, and §5 now says so explicitly rather than
leaving the reader to find out.

I got to define this rather than fix it: no Codex path was ever committed here,
so the nested layout the fork had never reached this repo. A test asserts the
sibling relationship directly, because "outside ./data" is the kind of invariant
a later refactor breaks by tidying.

bubblewrap and the Codex CLI are added in the coach target only — bubblewrap is
a Codex requirement, so an owner who never opted in carries neither. The image
job now asserts both directions: present and runnable in the coach image
(codex-cli 0.147.0, bubblewrap 0.11.2, /coach-auth as coach:0700), and absent
from the default one.

Codex is usable through the existing connect route with an API key, which needs
no new surface. Its ChatGPT device-code sign-in is not in this PR — see the PR
description for what that still needs.

api 73/73, frontend 404/404, both image targets built and inspected, 11 locales
in sync at 767, library in sync at 1324.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 07:28:16 +01:00
Duarte Santos 9daf637044 Gastmodus abschaltbar: ALLOW_GUEST=0 nimmt die Tuer ohne Konto raus (#42) 2026-08-07 08:10:19 +02:00
Duarte Santos b2b3577744 Release v1.2.6: Freestyle-Sessions starten dort, wo du aufgehoert hast 2026-08-07 07:38:56 +02:00
AlexandClaude Opus 5 ab1adcdd4f Coach: the screens, and the four things they were supposed to say
The Coach hub, the six-screen intake, the proposal review with per-change
accept/reject, and the admin card — wired into App.jsx and Admin.jsx. Nothing
renders unless the instance offers the Coach, so an admin page on a box that
never enabled it is the page it was before.

Four gaps I named earlier and owed this PR:

CoachProposal had no health disclaimer. The hub and the intake screen both
carry one; the screen where changes are actually accepted did not, which is the
one place it matters — that tap changes what somebody does with their body next
week. It sits immediately above the accept button on both proposal kinds
rather than at the top of a scrolling page, so it is on screen at the decision.

The admin card never showed whether the privilege drop can be performed. It
fails closed, so when it cannot, nothing runs at all, and the admin was left to
learn that from a user reporting silence. It now states the verdict, and the
server's own reason when the answer is no.

Whose account is being spent was not stated anywhere in the UI. Both the admin
card and the user's Coach screen have to name it, and that is only true if
neither infers it from settings — so coach-api gained the /api/coach/account
call that PR 1 built the route for and nothing had used since.

The credential UI was wired to a server shape that does not exist: it read
d.auth.state, which GET /api/admin/coach never sent, and posted to
/auth/setup-token, /auth/key and /auth/disconnect, none of which are routes.
Every credential button was dead. The card now uses the connect/disconnect
routes from 3/6, and the admin payload carries an auth summary — state, type
and account label, never the credential — with `unreadable` as its own state,
because ./data restored without its `secret` has a specific cause and a
specific fix rather than being "not connected".

Left out on purpose: the ChatGPT device-login sheet. It is Codex's, it calls
routes that do not exist, and Codex is 6/6 — so it comes back with the provider
it belongs to rather than shipping as unreachable UI here.

api 72/72, frontend 404/404, build clean, 11 locales in sync. The new strings
fall back to English until 5/6 adds them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 11:02:25 +01:00
AlexandClaude Opus 5 49be4e0626 Coach: the Claude provider, and an AI runtime you only carry if you ask
The Agent SDK adapter, its dependency, and the packaging that keeps both out
of the image an owner gets when they never wanted the Coach.

api/Dockerfile builds two targets. The default one runs `npm ci --omit=optional`
and ships no AI runtime at all (~158 MB); `--target coach` drops that flag and
adds @anthropic-ai/claude-agent-sdk (~455 MB). The SDK's runtime ships as a
per-platform package, so on this Alpine base the lockfile resolves the musl
build — the kind of thing that only fails on somebody else's machine, which is
why the new api-image CI job builds *and runs* both targets rather than merely
building them.

Both targets now create the unprivileged `coach` user. That is not a Claude
detail: canDropPrivileges() fails closed, so without it every job is refused —
including the fixture provider that exists so the loop can be walked before an
account is connected. The shipped image could not run one.

The adapter imports the SDK lazily, so an absent runtime stays an ordinary
reportable state rather than a boot crash: check() says so, isConnected() goes
false, and /api/config carries no coach key.

Four SDK options are what make this safe next to ./data — tools: [] (no Read,
no Bash, no Grep), settingSources: [], skills: [], strictMcpConfig. They are
one frozen exported object, asserted by value, so re-enabling one is a red
build rather than a quiet capability grant.

Verified against the SDK's own type definitions rather than from memory. Two
things the fork's draft had wrong: SDKResultError carries no `errors` field, so
`message.errors?.join()` was dead code and the failure reason now comes from
`subtype` and `stop_reason`; and the client-app version string was hardcoded at
1.2.3 two releases after it stopped being true, so it is read from package.json.

The credential connect/disconnect routes land here as promised in 2/6 — they
serve a credential, and until this PR there was no provider that had one.
authMode and the per-profile pair still wait for the side that consumes them.

api 72/72 on macOS and on Linux as uid 65534 with the SDK absent; both image
targets built and run; library in sync at 1324.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 10:46:28 +01:00
AlexandClaude Opus 5 2c76da270b Coach: put coach/ in the api image, which never had it
server.js has imported ./coach/config.js since 1/6, and the Dockerfile copies
only server.js. The published api image therefore cannot start:

  Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/coach/config.js'
  imported from /app/server.js

Reproduced by building `api/` at 9082ac5 and running it; /app/coach does not
exist in the image at all. With this line the same build boots and answers
/api/config.

Mine, from 1/6 — the line existed while I was working and was lost when I staged
that PR's files by name. Nothing caught it because the api has no image job: the
test job runs node:test against the source tree, where coach/ is obviously
present. 3/6 adds the api-image job whose whole purpose is that the image is
proven to run rather than merely to build, and rewrites this Dockerfile into the
multi-stage form the optional runtime needs. This is the one-line fix on its own,
because the branch tip currently ships a container that exits on boot.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 10:34:38 +01:00
Duarte Santos 9082ac5a2d Coach: was durch das Gatter kam, weil es nur gezaehlt und nicht geprueft wurde
Vier Stellen, eine Ursache: strukturierte `after`-Werte werden auf Zugehoerigkeit
geprueft, aber nicht auf die Form-Invarianten, die der Apply-Pfad voraussetzt.
Skalare Aenderungen sind dicht, die zusammengesetzten waren es nicht.

reorder akzeptierte doppelte Ids. ['0001','0001'] hat die richtige Laenge, jede Id
ist enthalten — Server und Client liessen es durch, die dritte Uebung war weg und
die verbliebene stand als dasselbe Objekt in zwei Slots. Ausgerechnet der einzige
Aenderungstyp, fuer den changeValues() null liefert: im Review-Screen ist kein
Vorher/Nachher zu sehen, das es haette verraten koennen. Jetzt Set-Vergleich auf
beiden Seiten.

superset konnte eine Uebung mit sich selbst verknuepfen. Der Partner-Splice nimmt
den Anker unter sich weg, danach schreibt das Tagging durch einen Index, der nicht
mehr aufloest — TypeError nach halbem Umsortieren. Der Client-Test prueft die
Meldung, nicht nur dass geworfen wird: geworfen hat der Bug auch.

add-routine hat unbekannte Exercise-Ids stillschweigend herausgefiltert, waehrend
validatePlan bei derselben Sache abbricht. Das ist FR-16, und es gilt hier genauso:
sonst bekommt jemand die Routine ohne die Uebungen, die es nicht geben konnte,
unter der Summary derjenigen, die er gesehen hat.

`before` war das einzige Feld, das ungeprueft durch das Gatter ging — ein Objekt
beliebiger Groesse landet im synchronisierten Coach-Log, ein bloss falsch getyptes
("3 sets" statt 3) laesst markStale eine voellig gute Aenderung deaktivieren. Der
Plan liegt im Validator bereits vor, also wird `before` dort gelesen statt von der
Antwort uebernommen.

api 68/68, frontend 404/404, Build sauber, Library in sync bei 1324.
2026-08-06 11:22:25 +02:00
AlexandClaude Opus 5 34d41b8e64 Coach: the validator, and the apply path it exists to protect
PR 1 stopped at transport and held every answer as `unvalidated`. This closes
that seam.

validate.js is the gate: a closed list of eighteen change types with no default
case, every exercise id resolved against the real catalogue, every target
resolved against the plan it claims to be about, and a rationale required on
every change. A hostile note in someone's free text can talk a model into saying
anything at all; it cannot invent a change type. Its errors join the parse
failures on the same single repair round, so a model that named an exercise
nobody has is told which one — and a model that cannot be told is a failed job
rather than a retry loop.

frontend/src/lib/coach.js is the other half: snapshot, apply, revert, and the
staleness rules. Applying happens on the client because it is ordinary local
editing — offline, synced like everything else, reversible without the server
knowing. A change-set is all-or-nothing, and a change aimed at something the
user has since edited by hand is disabled with its reason rather than silently
overwriting them.

Two things the seam was hiding, both from PR 1:

hashPlan hashed the pre-1.2.4 field list while canonicalPlan had already learned
repsMax, bodyweight and side — so it computed all three and threw them away. A
rep ceiling raised by hand fingerprinted as an untouched plan, on exactly the
exercises where that ceiling is how progression works. Both runtimes now hash
what canonicalPlan reports, with a test per field.

`refine` reads pending.bundle, and pending only ever carried `unvalidated`, so
`previous` resolved to null every time: the model was asked to refine a plan it
had never been shown. It works now, and the fixture echoes whether the previous
bundle arrived so a test can tell the difference.

The validator also enforces the two rules prompts/common.md states and could
not guarantee: unilateral reps are a total across both sides and must be even,
and a rep ceiling may not sit below its own floor.

"Nothing to change" keeps the reading it came with, on the profile's own record
— deliberately not in the instance log, which stays counts and outcomes only.

api 65/65, frontend 403/403, build clean, locales in sync, library in sync at
1324 exercises. No new dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 08:25:42 +01:00
Duarte Santos e28345dd13 Release v1.2.5: der MCP-Server, und sonst nichts an der App
Letztes publiziertes Release war v1.2.4, also ist das hier v1.2.5 — alles seit
dem Release in EINE Nummer. Inhalt ist genau eine Sache: der optionale
MCP-Server aus PR #19 nebst dem i18n-Kern-Split, der ihn ueberhaupt erst unter
reinem Node ladbar macht.

An der App selbst aendert sich nichts. Wer keinen KI-Client benutzt, merkt von
diesem Release ueberhaupt nichts: nichts wandert in den Docker-Build, die
docker-compose.yml bleibt unberuehrt.

Kein neues APK — der Bundle-Hash bewegt sich zwar (der Modulgraph haengt jetzt
direkt am i18n-Kern), aber verhalten tut sich die App identisch. Die
Download-Zeile auf der Website bleibt deshalb bei v1.2.4.
2026-08-04 16:35:34 +02:00
Duarte Santos de7f25cbe7 Coach: der Test-Lauf laeuft, und CI kann die Jobs ueberhaupt erreichen
Drei Sachen, die nie gelaufen sind, weil die CI fuer die api noch nicht existierte.

canDropPrivileges faellt unter Linux zu, solange der Prozess nicht root ist und
kein `coach`-User im Image steht. Ein CI-Runner ist Linux, laeuft als normaler
User und hat keinen `coach` — also hat dort jedes enqueue() refused, und acht
Tests waeren mit dem neuen api-Job rot geworden. Die Suite pinnt das Urteil
jetzt selbst, statt es vom Host zu erben; der Test, dem die Verweigerung selbst
gehoert, pinnt die Gegenrichtung und laeuft damit erstmals wirklich (vorher
sprang er auf jedem Host raus, auf dem der Drop zufaellig klappte — und rief
require() in einem ESM-Modul auf).

testRun() griff auf ein `job`, das in seinem Scope nicht existiert: ReferenceError
bei jedem Klick auf "Test the Coach", und weil der Wurf vor dem try lag, blieb
jedes Mal ein Temp-Verzeichnis liegen. Ohne Nutzer gibt es kein Profil, das
zahlt — im Instance-Modus ist das der gebundene Credential, im Profile-Modus
niemand.

Danach antwortete die Fixture auf den Test-Prompt mit einem ganzen Trainingsplan,
weil ohne Payload-Fence auf 'create' geraten wird. Genau dieser fehlende Fence
unterscheidet den Rundlauf von einem echten Job.

Dazu zwei Kleinigkeiten: /api/coach/disclosure verriet den Provider an
Nicht-Angemeldete, und der Poll, der ein Proposal verfallen laesst, lieferte als
einziger kein cap-Feld zurueck.
2026-08-04 16:11:43 +02:00
Alex 7be3978476 Coach: server plumbing, consent, payload boundary, credential model
First of six. Everything here is transport and boundary: a job can run, its
answer can be parsed, and nothing yet judges whether that answer is safe to
act on. The validator and the apply path are the next PR, and the seam is
explicit — jobs.js carries an answer no further than `unvalidated`, and a
test pins that so the next PR has something to replace.

Whose account pays, settled first because it decides what the rest may be:

  instance  one account in coach.json, for the single-profile instance
  profile   one account per profile, in its own coach-auth-<uid>.json

In instance mode the credential binds to the first profile that spends it and
every other profile is refused — no job, not a dismissible warning. A warning
moves the decision onto whoever clicks past it and the decision is about
somebody's personal subscription. A profile credential is deliberately not a
field on state-<uid>.json: that blob syncs and travels in the user's export,
and a credential in a backup is the mistake we are avoiding, not repeating.
openGym does not interpret any provider's terms; it offers the shape that
does not need the interpretation and refuses the shape that does.

The privilege drop now fails closed. It only ever engaged when the server ran
as root, so adding a USER line to the Dockerfile for unrelated hardening would
have silently left the provider runtime on the server's uid. On Linux, no drop
means no job, and the admin card says so.

./data is no longer sealed with a blanket 0700. It is a host bind mount and
this container is root, so sealing it landed on the host as root-owned and
took the owner's own directory hostage — backup scripts, jq, the MCP server in
issue #19. The files that hold secrets carry 0600 themselves instead, which is
what the directory mode was standing in for; db.json gained an explicit mode
rather than inheriting umask once the blanket came off.

Bodyweight and per-side, folded in rather than deferred: v1.2.4 made `weight`
mean *added* load on a bodyweight exercise, so it is 0 on a good session and
every load-shaped signal reads flat. Uncorrected, the Coach would have looked
at a working push-up progression and proposed adding weight to a push-up. The
payload carries bodyweight/side/repsMax, the session reader carries set count,
and the prompts say reps then sets are the progression and per-side targets
step in twos. coach-parity.test.js pins the server's three copied reading
rules against the frontend's originals over a table of configs — modeOf was
never actually pinned, and it is the one that was predicted to drift.

No AI dependency lands here: api/ still installs @simplewebauthn/server and
web-push and nothing else. Jobs run against the in-repo fixture provider, so
CI needs no account, no network and no image build.

33 api tests, 361 frontend tests (169 of them parity), locales in sync.
2026-08-03 01:00:56 +01:00
Duarte Santos 663e0b3987 Release v1.2.4: the effort stats, and bodyweight training that knows it is
v1.2.3 is published, so this is the next patch and everything since it belongs in
this one version: the Effort card and the readings built on it, the bodyweight and
per-side work from issues #31/#32/#33, and two fixes worth naming.

Versions bumped in frontend, api and the Android module (versionCode 5). CHANGELOG
gets the release heading and a Fixed section, README two feature bullets.
2026-08-01 17:07:17 +02:00
Duarte Santos accc3c1038 Sessions you can actually end, and invite codes worth guessing at
SECURITY.md documented three weaknesses two hours ago. Documented is better than
hidden; fixed is better than documented.

Sessions were a signed cookie the server trusted for a year, and /api/logout
only cleared it in the browser you clicked it in — a copy left on a shared
machine stayed good until it expired, and the only way to end it was deleting
./data/secret and signing out the entire instance. The cookie payload now
carries the user's session version, and POST /api/logout/all bumps it, which
kills every cookie that account ever had. Settings grows a "Sign out
everywhere" row for it.

Cookies already in the wild have no version field. They read as version 0 and
match a user who has never bumped, so nobody is signed out by this deploy and
db.json needs no migration — sv appears lazily on the first bump. Verified
against a server running the new code with a db.json shaped like the live one.

Session default drops from 365 days to 90, overridable with SESSION_DAYS. The
expiry is baked into each cookie when issued, so lowering it never cuts an
existing session short.

Invite codes go from 32 to 64 bits. The app has no rate limiting by design and
/api/register/options answers whether a code is valid, so the code itself has to
be the part not worth guessing. Existing codes still work — validation is an
exact string compare. Unused old ones are worth revoking and reissuing.

What did not change: no rate limiting, still the reverse proxy's job, still the
first caveat in SECURITY.md. requireUserVerification stays false — raising it
could refuse passkeys that already exist, which is a lockout, not a fix.
2026-07-31 19:32:57 +02:00
Duarte Santos 42d3659615 Release v1.2.3: effort per set, and the RPE your old app already had
Everything published since v1.2.2 is one number: the RIR column from #21 and
the RIR/RPE scale choice built on top of it, plus the importer reading the
RPE that Hevy and Strong export.

Changelog, README, roadmap and the website all describe the feature as it
actually shipped — a rating that is optional, keeps its scale per set, and
is deliberately not an input to progression or the 1RM estimate.

Android versionCode 4: it has to increase strictly or the APK will not
install over the v1.2.2 build already out there.
2026-07-31 00:16:43 +02:00
Duarte Santos 768dee50ca Release v1.2.2: history import, standalone mobile app, APK distribution
Consolidates everything since v1.2.1: the FitNotes/Strong/Hevy/Apple
Health importer, the Capacitor-based standalone mobile flavor, and the
store-free distribution story — signed Android APK from
opengym.duarte-santos.ch, docs corrected to match (no store listings;
iOS via self-hosted PWA or Xcode free signing).
2026-07-23 15:36:05 +02:00
Duarte Santos fac45f9af9 Release v1.2.1: muscle map and live demo
Consolidates everything since v1.2.0 into one version: the muscle map
(Stats balance card, routine preview, finish screen, male/female body
diagram), the browser-only GitHub Pages demo, and the fix for the blank
screen when finishing a workout from its last exercise.

api/package.json tracks the release alongside the frontend.
2026-07-23 12:56:52 +02:00
Duarte Santos 3c5bcd5957 Refresh README, self-hosting docs and dependencies for v1.2.0
Screenshots were still from the old design — all five regenerated from a
seeded three-month history.

The feature list had been behind since v1.1.0: push notifications and the
workout-day reminder were never listed, nor were custom exercises, the
equipment filter or the admin dashboard. ADMIN_UIDS and INVITE_ONLY were
documented in .env.example but missing from the README config table, and
docs/SELF_HOSTING.md still claimed there was no admin/invite system by
design — it now explains how to turn one on.

api/package.json version was lagging at 1.1.1; it tracks the release now.
React and @vitejs/plugin-react picked up their patch releases (lockfile
only, no manifest change); api dependencies were already current and both
trees audit clean.
2026-07-23 12:07:10 +02:00
Duarte Santos f3ba05aece Admin dashboard (phase 2): live 'training now' heartbeat + release v1.1.4
Backend: in-memory presence map + POST /api/activity heartbeat (authed);
each /api/admin/users row carries a fresh 'live' snapshot (routine,
exercise x/y, sets done/total, started-at) with a ~70s TTL. Disabling a
user clears their presence immediately.

Frontend: the workout screen pings /api/activity every 20s (signed-in
only) and sends a leave signal on unmount (fetch + sendBeacon). The
dashboard gains a 'Training now' section and live markers, auto-
refreshing every 15s.

Cuts the complete admin-dashboard feature (phases 1+2) as v1.1.4.
2026-07-22 02:06:19 +02:00
Duarte Santos 046217079c Admin dashboard (phase 1): users, disable, invite-gated signup
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.
2026-07-22 01:58:33 +02:00
Duarte Santos fbc615aa26 Release v1.1.1 2026-07-21 12:48:12 +02:00
Duarte Santos c5cf31e2ca Tighten reminder timing: 10s check interval + high-urgency push
Reminder loop only checked once a minute, unaligned to the minute
boundary, so it could sit up to 59s on the target time before noticing
- now capped at ~9s. Also mark pushes as urgency:'high', the one lever
we actually have over delivery speed (iOS/Android throttle low-urgency
background push harder under battery saving). Remaining delivery lag
after that is Apple/Google's own push relay scheduling, not something
we control from here.
2026-07-21 12:25:24 +02:00
Duarte Santos 10fa150d09 Flush pending state save immediately when tab backgrounds/closes
Settings changes (like the reminder time) were saved via a 1.5s
debounce; closing or switching away from the tab right after an edit
could kill that pending save before it reached the server, silently
losing the change. Now flushed on visibilitychange instead of relying
on the timer alone.

Also confirmed via a live server-side test (bypassing the client
entirely) that the reminder loop itself fires correctly — trimmed the
verbose per-tick debug log added for that test, kept the one for an
actual match.
2026-07-21 12:00:49 +02:00
Duarte Santos 0ac531acb8 Fix workout reminder using the server's timezone instead of the user's
The reminder compared 'now' against a single TZ env var, so it only
worked correctly for whoever's local time happened to match the
server's. The browser now reports its own IANA timezone (auto-
detected, no picker) and stores it with the reminder; the server
computes each user's local time/date individually via Intl, and the
client re-stamps it on every app load so it follows you when you
travel.
2026-07-21 11:46:45 +02:00
Duarte Santos 7dea9ccfcc Log push send failures instead of swallowing them silently
sendPush caught every webpush.sendNotification error to clean up
expired subscriptions, but never logged anything for other failure
modes — made a delivery problem indistinguishable from 'nothing to
send' when debugging.
2026-07-21 11:42:40 +02:00
Duarte Santos 0c240ba6f8 Release v1.1.0 2026-07-21 11:20:24 +02:00
Duarte Santos 4c2b6344f7 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.
2026-07-21 11:07:10 +02:00
Duarte Santos ca6fd7c4d6 Relicense to AGPL-3.0 + README glow-up (banner, badges, screenshots, roadmap, CHANGELOG)
- Lizenz von MIT auf GNU AGPL v3.0 (verhindert geschlossene/kommerzielle Forks;
  bleibt echtes Open Source). LICENSE, package.json, NOTICE, CONTRIBUTING, App-Footer
  (Source-Link, AGPL-Netzwerk-Klausel) angepasst
- README komplett überarbeitet: SVG-Banner/Logo, Badges, Screenshots (Home/Workout/
  Stats), Roadmap, Tech, klarere Struktur
- CHANGELOG.md + assets/ (Banner, Screenshots)
2026-07-20 20:42:33 +02:00
Duarte Santos 3333b4decd openGym: Open-Source-Release als Self-Hosting-App
Rebranding GymLog → openGym. Ein-Befehl-Self-Hosting via Docker Compose:
web (nginx serviert App + Proxy /api → api, ein Origin für Passkeys), api
(Node/WebAuthn), media-Service lädt Übungs-GIFs beim ersten Start automatisch.
Passkey-Domain über .env konfigurierbar (RP_ID/ORIGIN/WEB_PORT/RP_NAME),
Secure-Cookie nur bei HTTPS (http://localhost funktioniert). MIT-Lizenz,
README fürs Self-Hosting, docs/SELF_HOSTING.md, CONTRIBUTING.md.

Standalone-Stack Ende-zu-Ende getestet (Passkey-Register/-Login, Daten-Sync,
User-Isolation über den Proxy auf http://localhost).
2026-07-19 16:18:34 +02:00
Duarte Santos 29f5f64f8e GymLog: Gym- & Körpergewicht-Tracker — PWA mit Passkey-Login
Frontend: Static-SPA (Vanilla JS) — Dashboard, Wochenplan mit Per-Tag-Umplanung,
geführter Workout-Flow (Körpergewicht-Abfrage, Set-Logging, Rest-Timer, PR-Erkennung,
Gewichts-Bestätigung pro Übung), Activity-Heatmap, Kraft- & Gewichts-Charts,
Übungs-Bibliothek (1324 Übungen, autoplay GIFs), Swipe-Sheets, PWA/offline.

Backend: Node + @simplewebauthn — Passkey-Registrierung/-Login (Face ID),
HMAC-Session-Cookies, Per-User-State-Sync mit JSON-File-Storage.

Übungsdaten aus hasaneyldrm/exercises-dataset (Medien via scripts/fetch-media.sh).
2026-07-18 22:53:08 +02:00