Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

v1.3.9: editing history, the two sync and plan reports, password sign-in and thirty-nine community pull requests

Duarte Santos9753679c51a2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e1e9a7c2..2c07fedc4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,234 @@
# Changelog
+## v1.3.9 — 2026-09-28
+
+The milestone was "edit your history", and it is in: fix a saved workout after the fact, move it to
+another day, change how long it took, attach photos and videos to it. Around it, the two reports
+from Discord that mattered most — a paired phone that quietly stopped syncing and lost a week, and
+a routine planned at 2 × 10 that opened at 2 × 15 — are fixed at the root. Password sign-in for
+instances that want it, more than one passkey per profile, your own picture on your own exercises,
+Structural Balance, plate loading per set, the rest countdown in an Android notification, Ukrainian
+and Arabic. Thirty-nine community pull requests from eighteen contributors, plus five more taken
+in part. Web bundle, APK and API image.
+
+**The two reports from Discord**
+
+- 🔌 **A paired phone can no longer lose your workouts without telling you** (andi242). After the
+ server refused a phone's sign-in once — "Sign out everywhere" does that, so does an expired
+ token — the next start of the app unpaired it silently but kept you on screen, every sync after
+ that went nowhere and was counted as done, and Disconnect then wiped the phone. Every paired
+ phone since v1.2.10 could get there. Now:
+ - The app says when it is not connected, always: a line at the top for offline, a server that
+ cannot be reached, a server that refuses this phone, an answer that is not the server's, and
+ phone-only or guest use.
+ - A refused phone keeps its pairing and its data and offers **Pair again**. Phones already stuck
+ in that state from an earlier version are healed when they start, and their unsynced workouts
+ reach the server once they are paired again.
+ - **Settings → Server & sync** shows the host, the account, the status, the last sync, what is
+ still waiting, and a **Sync now** button.
+ - Disconnect and Sign out ask first when something has not reached the server yet — try again,
+ export it, or go ahead anyway. Going ahead keeps a copy on the device, and it is merged back
+ the next time you connect to the same account.
+ - Pairing again or signing in to the same account merges, instead of replacing the phone's copy
+ with the server's. A phone in use renews its sign-in on its own.
+ - Signing in or pairing waits for your answer to "add this device's workouts?" before it touches
+ anything, and a kg ↔ lb conversion, a reset or a backup import now reaches every device.
+ - Tip if you were hit by this: the phone's daily backup files (`Documents/openGym/`, or
+ `Documents/opengym-backup-….json` from before this version) may still hold the lost days —
+ Settings → Import.
+- 📋 **The plan owns the reps** (seals187, Supportlik, #275, #216). A session copied its reps from
+ the last time you did that exercise in *any* routine, so a 2 × 10 day opened at the 2 × 15 you
+ had done somewhere else. Now a planned session starts from the plan (Settings → "Planned sessions
+ start from": your plan, or your last session), progression runs per routine slot and falls back
+ to the exercise's history only when the slot has none, an edited plan restarts progression with
+ its new weight, and the card says "Plan: 2 × 10" (or "2 × 10–15" for a range).
+- 🔁 **Double progression waits for the top of the range** (Diego-Sanchez2000, #278, bluzername's
+ #297) before it adds weight.
+- 🗂️ **A stale second tab can no longer overwrite the server** (danielkleinert, #283). Each tab
+ tracks the revision it last saw, and a conflict keeps the latest edit of every routine and
+ workout instead of whole copies.
+- 📴 **The iPhone home-screen app opens offline again** (tpodolak, #274, bluzername's #298) — and a
+ slow connection no longer cuts a download off halfway.
+
+**Editing your history**
+
+- ✏️ **Edit a saved workout** (Space-Hermes, #203, #143, #229) — weights, reps, sets and exercises,
+ in the same screen you logged it on; progression and records re-read the corrected session. A
+ workout emptied in the editor offers to delete it instead of saving nothing.
+- 🕐 **Date, start time and duration** (Parth-Vasave, #263, expressiveminute, #218), without
+ touching what you lifted.
+- 📸 **Photos and videos on a workout** — attach them on the finish screen or in the workout's
+ detail. They live on your server and the device, never in the synced data.
+- 🗓️ **Log a missed day** (svillar, #284) — mark a planned routine from a past day as done; its
+ rows only look at the history from before that day.
+- 📚 Drop sets and supersets show in History, an exercise's history opens from a past workout, a
+ workout copies as text, a finished session saves as a routine of its own (Space-Hermes, #211),
+ and every weigh-in has a history with weekly averages.
+- 🚫 **"Don't count for progression"** for one exercise or a whole workout (the ⋯ and ⋮ menus) —
+ an injury day stays out of the next session's numbers.
+
+**Accounts and sign-in**
+
+- 🔐 **Password sign-in, if you want it** (#118). Off by default; an instance switches it on with
+ `PASSWORD_LOGIN=1`, and each profile opts in by setting a password in Settings. Sign in with the
+ profile's name or an e-mail address you add (no mail is ever sent). Passwords are stored with
+ scrypt, repeated wrong guesses pause sign-in for that name, and an admin can hand out a one-time
+ reset code. Removing a passkey or the password asks for proof first.
+- 🔑 **More than one passkey, and a new device by code** (AlexanderVott, #95). Settings lists a
+ profile's passkeys to add, rename or remove, and **Add another device** shows a one-time code and
+ QR; the code creates a passkey on the new device, never a session by itself.
+
+**During a workout**
+
+- ⏸️ **Pause the rest timer** — paused time does not count, and the alert moves with it.
+- 🔔 **The rest countdown in an Android notification** (vitox013, #296, #122), with Pause, ±15 s and
+ Skip, on time with the screen off. A louder chime, and a Vibrate switch of its own.
+- 🏋️ **Plate loading per set** (kurktchiev, #194) — each row shows the plates for its weight, from
+ the plates you own; "No bar" Smith machines count from zero, and drop sets land on a weight you
+ can actually load.
+- ⌨️ **Keyboard shortcuts** (#133) — Space or Enter ticks the next set, the arrow keys switch
+ exercise, for a keyboard or a Bluetooth button.
+- ⏱️ Rest timers stay on **Ready** when they run out, and a timed hold may run into overtime
+ (Space-Hermes, #204). The rest timer and a hold can no longer run at once (kurktchiev, #251).
+- The line under each exercise can show your **best set** instead of last time (Flxp49, #173); the
+ next workout card peeks in while you swipe (Space-Hermes, #202, sgoendoer, #113); "Set current"
+ goes straight to card view (bluzername, #262, xwr3, #260); typing an exact RIR/RPE no longer
+ ticks the set on the first keystroke (kurktchiev, #288).
+
+**Plan, library and stats**
+
+- 🧮 **Structural Balance** (Josevi, !140) — Stats compares your lifts with each other against the
+ Poliquin, Thibaudeau and ATG ratios and names the weakest one.
+- 🖼️ **Your own picture on your own exercises** (#126, #170; based on horusglez's #295 and
+ Vaibhav159's #246) — one photo, GIF or short video (up to 40 MB and 60 s) and one link per custom
+ exercise. The file is stripped of its location data, kept on your server and on the device, never
+ in the synced data, and works offline once seen; a YouTube link makes no request until you tap
+ it. Shared plans carry the link, never the file.
+- 🔄 **Replace an exercise in the routine editor** (codedmind, #110) and keep its sets, reps, weight
+ and rule; **print a single routine or save it as PDF** (Teo230, #282); swipe left to delete a
+ routine in Plan (Agripa22, #286); a drag handle on computers (seals187, #277, sgoendoer, #114).
+- A compact "+" on a day that already has a routine (seals187, #276), a live result count in
+ exercise search (GitLab !31), "benchpress" finds "bench press", cardio speed in mph for imperial
+ users, the activity heatmap by time or by volume (Space-Hermes, #205), repeated exercises add up
+ the same way in History and Stats (Space-Hermes, #212), a changed load cascades down the sets
+ without overwriting the ones you set by hand (Space-Hermes, #209), and the Home body-weight card
+ can be hidden (sacgsxr, #279).
+
+**Languages**
+
+- 🇺🇦 **Ukrainian** (illinoiseeee, #285) and 🇸🇦 **Arabic, laid out right to left** (smsmy, GitLab
+ !36) — seventeen languages in all.
+- 📖 **Exercise names in seven languages**: German (mkoester, #290), Spanish (AlexRomero12, #245),
+ Russian (dima-po, #266), Italian and French (giulioleuci, #254), next to Brazilian Portuguese and
+ Hungarian — each with a switch to show the English name beside it, or only the English name.
+- 🌐 **DEFAULT_LANG** (edgardjnr, #303) — an instance can pick the language of its sign-in screen and
+ of profiles that never chose one; otherwise a new visitor starts in their browser's language.
+- Russian demo strings (dima-po, #265), untranslated Coach equipment chips (dima-po, #264), and CSV
+ imports that read localized month names (sTOrM2202, #273).
+- "1 workout and 1 weigh-in" instead of "1 workouts and 1 weigh-ins" when signing in finds entries
+ from while you were signed out.
+
+**The AI Coach**
+
+- A review that swaps in an exercise the routine already has is told the rule and keeps the rest of
+ its proposal, instead of failing as "unusable" (fama-lama, #313).
+- Routine icons from the Coach work, and its plans pick more varied exercises (ameer-khan-ashraf,
+ #311).
+- The maximum message length is an admin setting (bluzername, #280, SSamDav, #267, #268).
+- A bonus set no longer reads as a stall you never had (kurktchiev, #287); Save in the Coach setup,
+ the demo Coach's failure state and the intake line are fixed (kurktchiev, #289); a weekly review
+ is due until it has run, not for one minute a week (kurktchiev, #249).
+- On an iPhone the Coach waits out a slow local model instead of giving up after 30 seconds
+ (thedandano, part of #187), and the phone refuses a plain `http://` endpoint with a reason.
+- A run that fails before its first status check still answers in the chat.
+
+**Imports**
+
+- Strong: a workout's Duration is its length and its Workout Notes the session note, and timed
+ holds come in as seconds. Hevy: supersets come in as supersets. The import summary shows the year
+ when the range is not this year.
+
+**Android and iPhone**
+
+- 📱 **Android 15**: sheets sit on top of the keyboard with the field you are typing in above it,
+ and with three-button navigation the tab bar sits above the navigation bar, so a tap on a tab no
+ longer lands on Home or Recents.
+- 🍎 **iPhone**: large photos and videos are kept in a form Safari can read back, so they play and
+ upload. The iOS build targets iOS 15.5 (clown-doing-code, #270).
+- 📦 The release APK carries only the ARM builds and is about 12 MB smaller (#136). Automatic
+ backups go to `Documents/openGym/` and only the newest 14 are kept (#161).
+- 🗂️ Exercise pictures stay available offline in the installed web app (xwr3, #281).
+
+**Self-hosting**
+
+- 🚢 **Kubernetes** (chriscowley, #304) — manifests in `kubernetes/` and a guide,
+ `docs/SELF_HOSTING_KUBERNETES.md`, with both images pinned to the same release.
+- Settings shows your account id, for an admin who needs to find your data (ItzEarthy, #219); the
+ admin's "last sync" counts pulls as well as pushes.
+
+**Security and robustness**
+
+- 🛡️ **Coach hardening**: everything that goes into a Coach prompt — what you typed, the plan, the
+ log, every id, and the "compare with others" figures — is bounded field by field before it is
+ sent, so no text from another account can reach your prompt and an oversized request is never
+ made.
+- 🚦 A sign-in throttle in front of the password routes, counted before the check.
+- The API answers a client's mistake as a client error and keeps its state cache bounded
+ (kurktchiev, #249); a push that carries nothing of the profile can no longer empty it on the
+ server; the admin's activity log names what each pause was for.
+
+**Community pull requests**
+
+- Space-Hermes: edit saved workouts (#203), Ready rest timers and hold overtime (#204), the heatmap
+ by time or volume (#205), load cascades that keep manual edits (#209), save a session as a routine
+ (#211), consistent totals for repeated exercises (#212), the swipe preview (#202).
+- kurktchiev: plate loading per set (#194), a build that names itself (#244), API hardening (#249),
+ the part of #250 this release took, the timer and hold fixes (#251), the API reference with the
+ Coach routes (#255), check-locales that reads the translations (#256), sheet pinning (#257), a
+ lighter tab bar (#258), and three Coach and effort fixes (#287, #288, #289).
+- bluzername: Set current to card view (#262), the Coach message length (#280), double progression
+ (#297), the service-worker timeout (#298).
+- dima-po: Coach equipment chips (#264), Russian demo strings (#265), Russian exercise names (#266).
+- Parth-Vasave (#263), vitox013 (#296), chriscowley (#304), ameer-khan-ashraf (#311), AlexRomero12
+ (#245), giulioleuci (#254), mkoester (#290), illinoiseeee (#285), clown-doing-code (#270),
+ sTOrM2202 (#273), sacgsxr (#279), Agripa22 (#286); on GitLab smsmy (!36) and Josevi (!140).
+- Taken in part, with thanks: AlexanderVott (#95), thedandano (#187), horusglez (#295),
+ Vaibhav159 (#246).
+
+**Thank you** to everyone who reported, tested and wrote code for this one: andi242, seals187,
+Supportlik, Diego-Sanchez2000, danielkleinert, tpodolak, svillar, expressiveminute, ncbachh,
+codedmind, Teo230, Flxp49, xwr3, sgoendoer, fama-lama, SSamDav, edgardjnr, ItzEarthy, asierlama,
+Space-Hermes, kurktchiev, bluzername, dima-po, Parth-Vasave, vitox013, chriscowley,
+ameer-khan-ashraf, AlexRomero12, giulioleuci, mkoester, illinoiseeee, clown-doing-code, sTOrM2202,
+sacgsxr, Agripa22, smsmy, Josevi, AlexanderVott, thedandano, horusglez and Vaibhav159.
+
+**Upgrading**
+
+- Nothing to migrate: v1.3.8 data opens as it is.
+- **Update paired phones.** The fixes for silently unpaired phones are in the app, not the server;
+ a phone still on v1.3.8 can still get stuck.
+- **"Sign out everywhere" unpairs phones too** — each one then shows Pair again, and keeps its data.
+- New, all optional, in `.env` (see `.env.example` and `docs/SELF_HOSTING.md`):
+ - `PASSWORD_LOGIN=1` switches password sign-in on. It is off by default. Give the api container
+ at least 256 MB of memory when it is on.
+ - `TRUST_PROXY` lets the sign-in throttle read the client's address from `X-Forwarded-For`. The
+ bundled `docker-compose.yml` now sets it, because there the api is reachable only through the
+ web container. Running the api any other way, turn it on only when whatever sits in front
+ overwrites that header.
+ - `MEDIA_*` for exercise and workout photos and videos: `MEDIA_UPLOADS=0` turns uploads off,
+ `MEDIA_QUOTA_MB` (200 per profile by default), `MEDIA_MIN_FREE_MB` (uploads stop below that much
+ free disk), and the per-type size limits. **Media needs disk space** — on a small disk or with
+ open signup, lower `MEDIA_QUOTA_MB`. Keep the web container's `MEDIA_UPLOAD_MAX` above
+ `MEDIA_VIDEO_MAX_MB`.
+ - `DEFAULT_LANG` for the instance's default language.
+- The api image carries new files (`password.js`, `rate-limit.js`, `passkeys-store.js`,
+ `device-link.js`, `media.js`). If you build your own image with an explicit file list, add them.
+- A reverse proxy with a short read timeout can cut off a slow video upload; photos are unaffected.
+
+**Known and not fixed**: counts in Russian, Ukrainian and Polish still use the English two-form
+plural rule ("2 дней" where it should read "2 дня"). The Ukrainian, Arabic, Hindi, Korean, Thai and
+Chinese packs have not been read by a native speaker yet — corrections are very welcome.
+
## v1.3.8 — 2026-09-20
Twenty-four reports closed: the keyboard that would not stay open on iPhone and iPad, notifications
diff --git a/README.md b/README.md
index 1b5b77da5..5879fca7e 100644
--- a/README.md
+++ b/README.md
@@ -87,7 +87,9 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
- 🎯 **Effort per set, in your scale** — an optional third column rating how hard a set was, as **RIR** (reps left in the tank) or **RPE** (the same judgement on a 10-point scale). Off by default; each set keeps the scale it was logged with, and nothing else reads the value — your progression and 1RM are unaffected
- 💪 **Bodyweight exercises, logged as bodyweight** — push-ups, pull-ups, dips and 300-odd others arrive knowing they carry no load, so there's no weight column and no working-weight prompt: one stepper, log the reps. Add a dip belt and it reads as an addition, and progression goes back to following the weight. Without one, reps climb — and past a ceiling you set, a set is added instead of a rep, up to the point where the honest advice is load or a harder variation
- ↔️ **Reps per side** — for lunges, single-arm rows and the rest. You log the total, the app shows the split ("8 per side"), and the target steps in twos so it never lands on a number one side can't have
-- 🏋️ **Plate math for barbell work** — barbell, EZ, trap bar and Smith machine carry a bar weight (20 kg / 45 lb and friends, or your own per exercise), and the workout screen tells you what goes on each side: *Bar 20 kg · 30 kg per side*. You still log the total, so your history, progression and 1RM keep meaning exactly what they always did
+- 🧮 **Structural Balance** — Stats compares your lifts against each other (Poliquin, Thibaudeau and ATG ratios) and names the weakest link
+- 🏋️ **Plate math for barbell work** — barbell, EZ, trap bar and Smith machine carry a bar weight (20 kg / 45 lb and friends, or your own per exercise), and the workout screen tells you what goes on each side: *Bar 20 kg · 30 kg per side* — and each set row can show its own plates, worked out from the plates you own. You still log the total, so your history, progression and 1RM keep meaning exactly what they always did
+- ✏️ **Edit a saved workout** — fix a weight, add a forgotten set or exercise, or change the duration after the fact, in the same screen you logged it on; progression and records re-read the corrected session. Attach photos and videos to a workout, copy it as text, or save it as a routine
- 📝 **Log a past workout** — forgot your phone, trained on paper, or switched apps? Add a session after the fact from History: date, start time, duration, routine or freestyle, then the normal workout screen — weights, reps, RIR/RPE, timed sets and all. If that day already has a workout you choose: replace it, keep both, or cancel. Backfilled sessions never claim PRs against workouts that came later
- ✏️ **Change when a workout happened** — typed a session in from another app, or logged it on the wrong day? Edit the date and start time of any workout in History. What you lifted is the record and is never touched — the sets, the volume and the notes stay put, and the session keeps the length it had; it just moves to where it belongs. PR badges the new order falsifies are taken back, and only the session you moved can earn one, so imported history never sprouts trophies it never had
- 🎲 **Freestyle sessions** — train without a plan and pick exercises as you go. Each one arrives prefilled from the last time you did it — same sets, same reps and weight by position — so an unplanned session doesn't start by asking you to retype last week
@@ -99,15 +101,16 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
- 💪 **Muscle map, three ways** — a front-and-back body diagram you can read as **Balance** (where the volume went, over a week, a month or all time — naming the muscles you *haven't* trained), **Fatigue** (what is still recovering, weighted by how close each set was to your maximum, decaying smoothly rather than expiring at a window edge) or **Strength** (how long since you trained each muscle, and behind every one the exercises that built it with their estimated 1RM). It previews what a routine hits while you build it, and shows what you just trained when you finish. Male or female figure, your pick
- 📳 **See the timer end, not just hear it** — an opt-in screen flash when a rest or work timer finishes, for loud gyms and headphones
- 🔔 **Push notifications** — rest-timer alerts even with the app closed, plus an optional reminder on days you have a workout planned but haven't logged one — on the Android app scheduled per calendar date, so a day you already trained or rescheduled stays quiet. Opt in per profile; keys are generated on first run, nothing to configure
-- 🔑 **Passkeys, not passwords** — Face ID / Touch ID / fingerprint login; each profile keeps its own data, synced across devices. Sign-ins last 90 days by default (configurable), and “sign out everywhere” in Settings ends every session on every device at once
+- 🔑 **Passkeys, not passwords** — Face ID / Touch ID / fingerprint login; each profile keeps its own data, synced across devices. Add as many passkeys as you have devices, or a new device with a one-time code or QR. An instance can also switch on password sign-in (off by default), by name or e-mail. Sign-ins last 90 days by default (configurable), and “sign out everywhere” in Settings ends every session on every device at once
+- 🔄 **Always says where your data is** — a line appears whenever the app is not connected to its server, Settings → Server & sync shows the host, the last sync and anything still waiting, and nothing that has not reached the server is thrown away on disconnect or sign-out
- 🛠️ **Admin dashboard** (optional) — for whoever runs the instance: who's training right now, per-user history, disable accounts, invite-only signup, and an **activity log** of sign-ins, failed attempts and admin actions. Off by default, so a fresh instance stays open with no admin
- 🎨 **Designed, not assembled** — light/dark themes and 8 accent colors saved to your profile, over a hand-drawn icon set instead of emoji, so it looks the same on every phone
-- 🌍 **14 languages** — full UI translation (EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU, ZH, KO, HI, TH, HU); exercise instructions localized in 12 of them and built-in exercise names shown bilingually in PT-BR and HU, all loaded on demand so the app stays fast
+- 🌍 **17 languages** — full UI translation (EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU, UK, ZH, KO, HI, TH, HU, AR), with Arabic laid out right to left; exercise instructions localized in 12 of them and built-in exercise names translated in seven (PT-BR, HU, DE, ES, RU, IT, FR), all loaded on demand so the app stays fast. A self-hosted instance can set its default language
- 📥 **Bring your history with you** — import from **FitNotes** (Android and iOS), **Strong** and **Hevy** (CSV or directly with a [Hevy Pro API key](https://hevy.com/settings?developer)), or body weight straight out of an **Apple Health** export. Exercise names are matched against the library and anything unrecognised becomes one of your own exercises, so nothing in the file is dropped
- 📦 **Yours to keep** — one-tap JSON export/import, guest mode, **no telemetry**; switching kg ↔ lb offers to convert every stored number
- 🤖 **Ask an AI about your training** (optional) — an [MCP server](mcp/README.md) lets a client like Claude Desktop or Cursor read your history in your own words: *"what did I bench last week?"*. Read-only, spawned locally by the client, nothing leaves your box. Not in the Docker build — if you don't use an AI assistant, it isn't there
- 🧠 **An AI coach that writes your plan** (optional, off by default) — answer a handful of questions and it designs a week of routines; later it reads what you actually logged and proposes changes, each one with the evidence behind it. You approve every change and can undo it. It runs on **your** server under **your** provider account — Anthropic, OpenAI, Gemini or any OpenAI-compatible endpoint (Ollama on your LAN counts) with a pasted API key on the default image, or the Claude Agent SDK / Codex CLI on a separate build. The phone app can use your instance or its own key. See [docs/AI_COACH.md](docs/AI_COACH.md)
-- 📱 **Standalone Android app** — the whole tracker as a sideloadable APK: no account, no server, data on the phone, native workout reminders, and an **in-app update check** that downloads the next signed APK and verifies its checksum ([download](https://opengym.duarte-santos.ch))
+- 📱 **Standalone Android app** — the whole tracker as a sideloadable APK: no account, no server, data on the phone, native workout reminders, the rest countdown in a notification that stays on time with the screen off, and an **in-app update check** that downloads the next signed APK and verifies its checksum ([download](https://opengym.duarte-santos.ch))
## Quick start (self-host)
diff --git a/ROADMAP.md b/ROADMAP.md
index e88d572cb..7151d00d6 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -86,26 +86,37 @@ twenty-four reports in total. See the changelog for the full list.
- The small open pull requests: unknown-path redirect (#185), manifest behind an auth proxy (#184),
standard ß (#190) ✅ — the distance mode (#177, #178) moves to a later release
-## v1.3.9 — Editing history (2026-10-11)
-
-- **Edit a finished workout** — date, start time, duration, name, sets, weights, add or remove an
- exercise; progression and 1RM history re-read the corrected session (#143; GitLab !127 and !139
- as reference; Discord "edit finished workouts", "edit past workouts time", "change the date")
-- Save a logged workout as a routine, repeat a past workout from History, undo finish (#111, #58,
- GitLab !130; Discord "Historic tab")
-- Relabel an "Unknown" exercise after an import without losing its sets; copy a workout as text
- (Discord)
-- Auto-backup keeps the last N files (#161, first half); a "next step" hotkey independent of focus
- (#133); body measurements (PR #82), extra passkeys and the device link (PR #95)
+## v1.3.9 — Editing history (released 2026-09-28, two weeks early)
+
+Edit a saved workout, its date, start time and duration, with photos and videos on it — plus the
+two Discord reports (a paired phone that silently stopped syncing, a plan that opened at the wrong
+reps) fixed at the root, and a good part of later milestones pulled forward: password sign-in and
+extra passkeys, custom-exercise pictures, the Android rest notification, plate loading per set,
+Structural Balance, Ukrainian and Arabic. Thirty-nine community pull requests. See the changelog.
+
+- **Edit a finished workout** — date, start time, duration, sets, weights, exercises; progression
+ and 1RM history re-read the corrected session (#143, #203, #263, #218) ✅
+- Save a logged workout as a routine (#111, #211) ✅ — repeating a past workout from History and
+ undo finish (#58, GitLab !130) move to v1.3.10
+- Copy a workout as text ✅ — relabelling an "Unknown" exercise after an import moves to v1.3.10
+- Auto-backup keeps the newest 14 files (#161, first half) ✅; a "next step" hotkey independent of
+ focus (#133) ✅; extra passkeys and the device link (PR #95) ✅ — body measurements (PR #82) move
+ to v1.3.10
## v1.3.10 — Session queue & rotation (2026-10-25)
+Next up.
+
- A free-running session queue beside the fixed week — the next session is the next undone one,
whatever the weekday — with an in-app editor and automatic refill (#158, #69; PR #167 and the
editor on top of it; Discord "not forced into a weekly plan")
-- Swipe between exercise cards during a workout (#113, GitLab !114)
+- Swipe between exercise cards during a workout (#113, GitLab !114) — the swipe preview landed in
+ v1.3.9 (#202) ✅
- Drag-and-drop exercise order that survives touch (#114 — the first version came out again on
- 2026-09-07); the Start/Resume button as "next" during a workout (Discord)
+ 2026-09-07; a drag handle on computers came in v1.3.9, #277); the Start/Resume button as "next"
+ during a workout (Discord)
+- Rolled over from v1.3.9: repeat a past workout from History and undo finish (#58, GitLab !130),
+ relabel an "Unknown" exercise after an import without losing its sets, body measurements (PR #82)
## v1.3.11 — Programmes & phases (2026-11-08)
@@ -133,7 +144,8 @@ twenty-four reports in total. See the changelog for the full list.
- Cardio: incline and intervals (rounds × work/rest), interval programmes such as C25k, rucking as
distance + pace + load (#132, #169; Discord "incline treadmill", "cardio programs", "rucking")
-- Exercise alternatives per routine slot, and Replace in the routine editor (#110; Discord)
+- Exercise alternatives per routine slot (Discord); Replace in the routine editor came in v1.3.9
+ (#110) ✅
- Complexes and interval groups beside supersets (Discord)
## v1.4.0 — Foundation: database (2027-01-10)
@@ -159,7 +171,7 @@ default so `docker compose up` stays one line, a server database as an option (D
## v1.4.2 — Accounts: password & OIDC (2027-02-07)
- Optional username + password login next to passkeys (#118; Discord "Basic login", the
- password-manager thread)
+ password-manager thread) ✅ — shipped early in v1.3.9, behind `PASSWORD_LOGIN`
- OIDC login for PocketID / Authelia-style setups (#130, #72; GitLab !132 is the candidate)
## v1.4.3 — Trainer & MCP write (2027-02-21)
@@ -180,8 +192,10 @@ default so `docker compose up` stays one line, a server database as an option (D
- Health Connect for weight and sessions (Discord "Use health connect"); Withings and other scales
(#127)
-- The rest timer as an ongoing notification on the lock screen (#122); a home-screen widget (#125)
-- APK back under 10 MB with ABI filters (#136); the auto-backup directory picker (#161, second half)
+- The rest timer as an ongoing notification on the lock screen (#122, PR #296) ✅ in v1.3.9; a
+ home-screen widget (#125)
+- APK ABI filters (#136) ✅ in v1.3.9, about 12 MB smaller; the auto-backup directory picker (#161,
+ second half)
- Media for the routine's exercises cached on the phone, so a session works with no signal (#123;
Discord "Download all videos")
- Firefox-on-Windows QR and third-party passkey providers stay documented, not fixed — platform
@@ -189,12 +203,13 @@ default so `docker compose up` stays one line, a server database as an option (D
## v1.4.6 — Exercises & catalogue (2027-04-04)
-- Pictures for custom exercises: pick from the catalogue, then upload; a video URL per exercise
- (#126, #170; Discord "custom images/GIFs", "upload videos")
+- Pictures for custom exercises: upload a photo, GIF or video and a link per exercise ✅ in v1.3.9
+ (#126, #170); picking one from the catalogue and media on built-in exercises (#259) stay here
+ (Discord "custom images/GIFs", "upload videos")
- Catalogue: bench as equipment with flat / adjustable, TRX / suspension, lats and the three delts
as their own categories, exercises that should not carry weight, more routine icons (#132, #188;
Discord)
-- Choose what the "last time" line shows on the logger (#173); one progress line per set number
+- Choose what the "last time" line shows on the logger (#173) ✅ in v1.3.9; one progress line per set number
(#145); custom heatmap targets per muscle; a shareable image after a workout (Discord)
## v1.4.7 — Looks, social, plugins (2027-04-18)
@@ -203,7 +218,7 @@ default so `docker compose up` stays one line, a server database as an option (D
#134, #135)
- Social: friends, progress and plan sharing (PR #180); a plugin surface for integrations (Discord)
- Native NixOS module (GitLab !83) and Azure deployment (!35) only if someone maintains them;
- Arabic and right-to-left (GitLab !36) once rebased
+ Arabic and right-to-left (GitLab !36) ✅ in v1.3.9
## How things move
diff --git a/api/openapi.yaml b/api/openapi.yaml
index 5f58ce150..abb279e45 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -6,7 +6,7 @@ openapi: 3.1.0
info:
title: openGym API
- version: 1.3.8
+ version: 1.3.9
summary: Passkey (WebAuthn) auth + per-user state storage for openGym
description: |
The backend of [openGym](https://opengym.duarte-santos.ch) — a free, open-source
diff --git a/api/package-lock.json b/api/package-lock.json
index 4919909ef..08610e9da 100644
--- a/api/package-lock.json
+++ b/api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "gym-api",
- "version": "1.3.8",
+ "version": "1.3.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gym-api",
- "version": "1.3.8",
+ "version": "1.3.9",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@simplewebauthn/server": "^13.1.1",
diff --git a/api/package.json b/api/package.json
index 2f748ecb0..5de28b3fe 100644
--- a/api/package.json
+++ b/api/package.json
@@ -1,6 +1,6 @@
{
"name": "gym-api",
- "version": "1.3.8",
+ "version": "1.3.9",
"private": true,
"type": "module",
"main": "server.js",
diff --git a/frontend/android/app/build.gradle b/frontend/android/app/build.gradle
index 5f77084b0..4a3f8dcc2 100644
--- a/frontend/android/app/build.gradle
+++ b/frontend/android/app/build.gradle
@@ -7,8 +7,8 @@ android {
applicationId "ch.duartesantos.opengym"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 22
- versionName "1.3.8"
+ versionCode 23
+ versionName "1.3.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 85f686cfe..d7b105a79 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "opengym-frontend",
- "version": "1.3.8",
+ "version": "1.3.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opengym-frontend",
- "version": "1.3.8",
+ "version": "1.3.9",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@aparajita/capacitor-secure-storage": "^7.1.6",
diff --git a/frontend/package.json b/frontend/package.json
index 8f7685bd4..91e463b40 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "opengym-frontend",
"private": true,
- "version": "1.3.8",
+ "version": "1.3.9",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 9cee05594..07697206c 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1291,6 +1291,9 @@ export default {
'Music playing on this phone stops during a workout and does not resume by itself.': 'الموسيقى التي تعمل على هذا الهاتف تتوقف أثناء التمرين ولا تستأنف من تلقاء نفسها.',
'Add this device\'s workouts to your profile?': 'إضافة تدريبات هذا الجهاز إلى ملفك؟',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'سُجلت {0} تدريبات و{1} قياسات وزن على هذا الجهاز أثناء تسجيل الخروج. أضفها إلى ملفك، أو أبقِ الملف كما هو على الخادم.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'سُجل {0} تدريب و{1} قياس وزن على هذا الجهاز أثناء تسجيل الخروج. أضفهما إلى ملفك، أو أبقِ الملف كما هو على الخادم.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'سُجل {0} تدريب و{1} قياسات وزن على هذا الجهاز أثناء تسجيل الخروج. أضفها إلى ملفك، أو أبقِ الملف كما هو على الخادم.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'سُجلت {0} تدريبات و{1} قياس وزن على هذا الجهاز أثناء تسجيل الخروج. أضفها إلى ملفك، أو أبقِ الملف كما هو على الخادم.',
'Add them': 'أضفها',
'Keep profile as is': 'إبقاء الملف كما هو',
'Offline — your changes are saved on this device and sync when you are back online.': 'غير متصل — تُحفظ تغييراتك على هذا الجهاز وتتزامن عند عودة الاتصال.',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index bf7dbf128..663a5a5bb 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1410,6 +1410,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Trainings von diesem Gerät zum Profil hinzufügen?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} Trainings und {1} Wiegungen wurden auf diesem Gerät ohne Anmeldung erfasst. Zum Profil hinzufügen oder das Profil genau so lassen, wie es auf dem Server ist.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} Training und {1} Wiegung wurden auf diesem Gerät ohne Anmeldung erfasst. Zum Profil hinzufügen oder das Profil genau so lassen, wie es auf dem Server ist.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} Training und {1} Wiegungen wurden auf diesem Gerät ohne Anmeldung erfasst. Zum Profil hinzufügen oder das Profil genau so lassen, wie es auf dem Server ist.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} Trainings und {1} Wiegung wurden auf diesem Gerät ohne Anmeldung erfasst. Zum Profil hinzufügen oder das Profil genau so lassen, wie es auf dem Server ist.',
'Add them': 'Hinzufügen',
'Keep profile as is': 'Profil so lassen',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — deine Änderungen sind auf diesem Gerät gespeichert und werden synchronisiert, sobald du wieder online bist.',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index ffc0c5d06..8e1d9aa99 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': '¿Añadir los entrenamientos de este dispositivo a tu perfil?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} entrenamientos y {1} pesajes se registraron en este dispositivo sin iniciar sesión. Añádelos a tu perfil o deja el perfil exactamente como está en el servidor.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} entrenamiento y {1} pesaje se registraron en este dispositivo sin iniciar sesión. Añádelos a tu perfil o deja el perfil exactamente como está en el servidor.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} entrenamiento y {1} pesajes se registraron en este dispositivo sin iniciar sesión. Añádelos a tu perfil o deja el perfil exactamente como está en el servidor.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} entrenamientos y {1} pesaje se registraron en este dispositivo sin iniciar sesión. Añádelos a tu perfil o deja el perfil exactamente como está en el servidor.',
'Add them': 'Añadirlos',
'Keep profile as is': 'Dejar el perfil como está',
'Offline — your changes are saved on this device and sync when you are back online.': 'Sin conexión: tus cambios se guardan en este dispositivo y se sincronizarán cuando vuelvas a estar en línea.',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index f7b15690c..ee904194c 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Ajouter les séances de cet appareil à votre profil ?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} séances et {1} pesées ont été enregistrées sur cet appareil sans connexion. Ajoutez-les à votre profil ou gardez le profil exactement tel qu’il est sur le serveur.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} séance et {1} pesée ont été enregistrées sur cet appareil sans connexion. Ajoutez-les à votre profil ou gardez le profil exactement tel qu’il est sur le serveur.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} séance et {1} pesées ont été enregistrées sur cet appareil sans connexion. Ajoutez-les à votre profil ou gardez le profil exactement tel qu’il est sur le serveur.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} séances et {1} pesée ont été enregistrées sur cet appareil sans connexion. Ajoutez-les à votre profil ou gardez le profil exactement tel qu’il est sur le serveur.',
'Add them': 'Les ajouter',
'Keep profile as is': 'Garder le profil tel quel',
'Offline — your changes are saved on this device and sync when you are back online.': 'Hors ligne — vos modifications sont enregistrées sur cet appareil et seront synchronisées dès le retour de la connexion.',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 26d9efa1f..ccb0ca2aa 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'इस डिवाइस के वर्कआउट अपनी प्रोफ़ाइल में जोड़ें?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} वर्कआउट और {1} वज़न इस डिवाइस पर बिना साइन इन किए दर्ज किए गए। इन्हें अपनी प्रोफ़ाइल में जोड़ें, या प्रोफ़ाइल को ठीक वैसा ही रखें जैसा सर्वर पर है।',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} वर्कआउट और {1} वज़न इस डिवाइस पर बिना साइन इन किए दर्ज किए गए। इन्हें अपनी प्रोफ़ाइल में जोड़ें, या प्रोफ़ाइल को ठीक वैसा ही रखें जैसा सर्वर पर है।',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} वर्कआउट और {1} वज़न इस डिवाइस पर बिना साइन इन किए दर्ज किए गए। इन्हें अपनी प्रोफ़ाइल में जोड़ें, या प्रोफ़ाइल को ठीक वैसा ही रखें जैसा सर्वर पर है।',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} वर्कआउट और {1} वज़न इस डिवाइस पर बिना साइन इन किए दर्ज किए गए। इन्हें अपनी प्रोफ़ाइल में जोड़ें, या प्रोफ़ाइल को ठीक वैसा ही रखें जैसा सर्वर पर है।',
'Add them': 'जोड़ें',
'Keep profile as is': 'प्रोफ़ाइल वैसी ही रखें',
'Offline — your changes are saved on this device and sync when you are back online.': 'ऑफ़लाइन — आपके बदलाव इस डिवाइस पर सहेजे गए हैं और ऑनलाइन होते ही सिंक हो जाएँगे।',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index ca82839ba..61b151edc 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1393,6 +1393,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Hozzáadod az eszközön lévő edzéseket a profilodhoz?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} edzés és {1} mérés került rögzítésre ezen az eszközön bejelentkezés nélkül. Add hozzá őket a profilodhoz, vagy hagyd a profilt pontosan úgy, ahogy a szerveren van.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} edzés és {1} mérés került rögzítésre ezen az eszközön bejelentkezés nélkül. Add hozzá őket a profilodhoz, vagy hagyd a profilt pontosan úgy, ahogy a szerveren van.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} edzés és {1} mérés került rögzítésre ezen az eszközön bejelentkezés nélkül. Add hozzá őket a profilodhoz, vagy hagyd a profilt pontosan úgy, ahogy a szerveren van.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} edzés és {1} mérés került rögzítésre ezen az eszközön bejelentkezés nélkül. Add hozzá őket a profilodhoz, vagy hagyd a profilt pontosan úgy, ahogy a szerveren van.',
'Add them': 'Hozzáadás',
'Keep profile as is': 'Profil marad',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — a módosításaid ezen az eszközön vannak mentve, és szinkronizálódnak, amint újra online leszel.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index acec903a6..48e5dd34d 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Aggiungere gli allenamenti di questo dispositivo al tuo profilo?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} allenamenti e {1} pesate sono stati registrati su questo dispositivo senza accesso. Aggiungili al tuo profilo o lascia il profilo esattamente com’è sul server.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} allenamento e {1} pesata sono stati registrati su questo dispositivo senza accesso. Aggiungili al tuo profilo o lascia il profilo esattamente com’è sul server.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} allenamento e {1} pesate sono stati registrati su questo dispositivo senza accesso. Aggiungili al tuo profilo o lascia il profilo esattamente com’è sul server.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} allenamenti e {1} pesata sono stati registrati su questo dispositivo senza accesso. Aggiungili al tuo profilo o lascia il profilo esattamente com’è sul server.',
'Add them': 'Aggiungili',
'Keep profile as is': 'Lascia il profilo com’è',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — le tue modifiche sono salvate su questo dispositivo e verranno sincronizzate quando tornerai online.',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 24aea66b0..02628fa0a 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': '이 기기의 운동을 프로필에 추가할까요?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '로그인하지 않은 상태에서 이 기기에 운동 {0}개와 체중 기록 {1}개가 기록되었습니다. 프로필에 추가하거나 서버에 있는 프로필을 그대로 유지하세요.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '로그인하지 않은 상태에서 이 기기에 운동 {0}개와 체중 기록 {1}개가 기록되었습니다. 프로필에 추가하거나 서버에 있는 프로필을 그대로 유지하세요.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '로그인하지 않은 상태에서 이 기기에 운동 {0}개와 체중 기록 {1}개가 기록되었습니다. 프로필에 추가하거나 서버에 있는 프로필을 그대로 유지하세요.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '로그인하지 않은 상태에서 이 기기에 운동 {0}개와 체중 기록 {1}개가 기록되었습니다. 프로필에 추가하거나 서버에 있는 프로필을 그대로 유지하세요.',
'Add them': '추가',
'Keep profile as is': '프로필 그대로 유지',
'Offline — your changes are saved on this device and sync when you are back online.': '오프라인 — 변경 사항은 이 기기에 저장되며 다시 온라인이 되면 동기화됩니다.',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index ada4f393e..f5910a684 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Dodać treningi z tego urządzenia do profilu?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treningów i {1} ważeń zapisano na tym urządzeniu bez logowania. Dodaj je do profilu albo zostaw profil dokładnie taki, jaki jest na serwerze.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} trening i {1} ważenie zapisano na tym urządzeniu bez logowania. Dodaj je do profilu albo zostaw profil dokładnie taki, jaki jest na serwerze.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} trening i {1} ważeń zapisano na tym urządzeniu bez logowania. Dodaj je do profilu albo zostaw profil dokładnie taki, jaki jest na serwerze.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treningów i {1} ważenie zapisano na tym urządzeniu bez logowania. Dodaj je do profilu albo zostaw profil dokładnie taki, jaki jest na serwerze.',
'Add them': 'Dodaj',
'Keep profile as is': 'Zostaw profil bez zmian',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — zmiany są zapisane na tym urządzeniu i zsynchronizują się, gdy znów będziesz online.',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 06c739813..41505d76e 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -5,6 +5,9 @@ import pt from './pt.js'
export const PT_BR_OVERRIDES = {
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treinos e {1} pesagens foram registrados neste dispositivo sem login. Adicione-os ao seu perfil ou mantenha o perfil exatamente como está no servidor.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treino e {1} pesagem foram registrados neste dispositivo sem login. Adicione-os ao seu perfil ou mantenha o perfil exatamente como está no servidor.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treino e {1} pesagens foram registrados neste dispositivo sem login. Adicione-os ao seu perfil ou mantenha o perfil exatamente como está no servidor.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treinos e {1} pesagem foram registrados neste dispositivo sem login. Adicione-os ao seu perfil ou mantenha o perfil exatamente como está no servidor.',
'Add this device\'s workouts to your profile?': 'Adicionar os treinos deste dispositivo ao seu perfil?',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — suas alterações ficam salvas neste dispositivo e sincronizam assim que você voltar a ficar online.',
'Not synced yet — tap to retry.': 'Ainda não sincronizado — toque para tentar novamente.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 9c6214514..65dd8ff54 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Adicionar os treinos deste dispositivo ao teu perfil?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treinos e {1} pesagens foram registados neste dispositivo sem sessão iniciada. Adiciona-os ao teu perfil ou mantém o perfil exatamente como está no servidor.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treino e {1} pesagem foram registados neste dispositivo sem sessão iniciada. Adiciona-os ao teu perfil ou mantém o perfil exatamente como está no servidor.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treino e {1} pesagens foram registados neste dispositivo sem sessão iniciada. Adiciona-os ao teu perfil ou mantém o perfil exatamente como está no servidor.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} treinos e {1} pesagem foram registados neste dispositivo sem sessão iniciada. Adiciona-os ao teu perfil ou mantém o perfil exatamente como está no servidor.',
'Add them': 'Adicionar',
'Keep profile as is': 'Manter o perfil como está',
'Offline — your changes are saved on this device and sync when you are back online.': 'Offline — as tuas alterações ficam guardadas neste dispositivo e sincronizam assim que voltares a estar online.',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 704a05839..2df1568f7 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Добавить тренировки с этого устройства в профиль?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} тренировок и {1} взвешиваний были записаны на этом устройстве без входа. Добавьте их в профиль или оставьте профиль ровно таким, как на сервере.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} тренировка и {1} взвешивание были записаны на этом устройстве без входа. Добавьте их в профиль или оставьте профиль ровно таким, как на сервере.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} тренировка и {1} взвешиваний были записаны на этом устройстве без входа. Добавьте их в профиль или оставьте профиль ровно таким, как на сервере.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '{0} тренировок и {1} взвешивание были записаны на этом устройстве без входа. Добавьте их в профиль или оставьте профиль ровно таким, как на сервере.',
'Add them': 'Добавить',
'Keep profile as is': 'Оставить профиль как есть',
'Offline — your changes are saved on this device and sync when you are back online.': 'Офлайн — изменения сохранены на этом устройстве и синхронизируются, как только появится сеть.',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index ea7753f30..3604d80fa 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1401,6 +1401,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'เพิ่มการฝึกจากอุปกรณ์นี้ลงในโปรไฟล์ของคุณหรือไม่',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'มีการบันทึกการฝึก {0} ครั้งและการชั่งน้ำหนัก {1} ครั้งบนอุปกรณ์นี้ขณะไม่ได้ลงชื่อเข้าใช้ เพิ่มลงในโปรไฟล์ของคุณ หรือคงโปรไฟล์ไว้ตามที่อยู่บนเซิร์ฟเวอร์',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'มีการบันทึกการฝึก {0} ครั้งและการชั่งน้ำหนัก {1} ครั้งบนอุปกรณ์นี้ขณะไม่ได้ลงชื่อเข้าใช้ เพิ่มลงในโปรไฟล์ของคุณ หรือคงโปรไฟล์ไว้ตามที่อยู่บนเซิร์ฟเวอร์',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'มีการบันทึกการฝึก {0} ครั้งและการชั่งน้ำหนัก {1} ครั้งบนอุปกรณ์นี้ขณะไม่ได้ลงชื่อเข้าใช้ เพิ่มลงในโปรไฟล์ของคุณ หรือคงโปรไฟล์ไว้ตามที่อยู่บนเซิร์ฟเวอร์',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'มีการบันทึกการฝึก {0} ครั้งและการชั่งน้ำหนัก {1} ครั้งบนอุปกรณ์นี้ขณะไม่ได้ลงชื่อเข้าใช้ เพิ่มลงในโปรไฟล์ของคุณ หรือคงโปรไฟล์ไว้ตามที่อยู่บนเซิร์ฟเวอร์',
'Add them': 'เพิ่ม',
'Keep profile as is': 'คงโปรไฟล์ไว้',
'Offline — your changes are saved on this device and sync when you are back online.': 'ออฟไลน์ — การเปลี่ยนแปลงถูกบันทึกไว้ในอุปกรณ์นี้และจะซิงค์เมื่อกลับมาออนไลน์',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 8b7e1d524..1c96ebc30 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': 'Bu cihazdaki antrenmanlar profiline eklensin mi?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'Bu cihazda oturum açılmadan {0} antrenman ve {1} tartım kaydedildi. Bunları profiline ekle ya da profili sunucudaki hâliyle bırak.',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'Bu cihazda oturum açılmadan {0} antrenman ve {1} tartım kaydedildi. Bunları profiline ekle ya da profili sunucudaki hâliyle bırak.',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'Bu cihazda oturum açılmadan {0} antrenman ve {1} tartım kaydedildi. Bunları profiline ekle ya da profili sunucudaki hâliyle bırak.',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': 'Bu cihazda oturum açılmadan {0} antrenman ve {1} tartım kaydedildi. Bunları profiline ekle ya da profili sunucudaki hâliyle bırak.',
'Add them': 'Ekle',
'Keep profile as is': 'Profili olduğu gibi bırak',
'Offline — your changes are saved on this device and sync when you are back online.': 'Çevrimdışı — değişikliklerin bu cihazda kayıtlı, tekrar çevrimiçi olunca eşitlenecek.',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index e83161e1f..ba239e0c8 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1235,6 +1235,9 @@ export default {
"No exercises yet.": "Вправ поки немає.",
"Add this device's workouts to your profile?": "Додати тренування з цього пристрою в профіль?",
"{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.": "На цьому пристрої без входу записано тренувань: {0} і зважувань: {1}. Додай їх у профіль або лиши профіль точно таким, як на сервері.",
+ "{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.": "На цьому пристрої без входу записано {0} тренування і {1} зважування. Додай їх у профіль або лиши профіль точно таким, як на сервері.",
+ "{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.": "На цьому пристрої без входу записано {0} тренування і зважувань: {1}. Додай їх у профіль або лиши профіль точно таким, як на сервері.",
+ "{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.": "На цьому пристрої без входу записано тренувань: {0} і {1} зважування. Додай їх у профіль або лиши профіль точно таким, як на сервері.",
"Add them": "Додати",
"Keep profile as is": "Лишити профіль як є",
"Offline — your changes are saved on this device and sync when you are back online.": "Офлайн — зміни збережено на цьому пристрої, вони синхронізуються, щойно з'явиться мережа.",
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 8a916e656..84237894a 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1390,6 +1390,9 @@ export default {
// --- sign-in adoption + offline banner (v1.3.6) ---
'Add this device\'s workouts to your profile?': '把此设备上的训练加入你的个人资料?',
'{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '此设备在未登录时记录了 {0} 次训练和 {1} 次体重。把它们加入你的个人资料,或保持个人资料与服务器上的完全一致。',
+ '{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '此设备在未登录时记录了 {0} 次训练和 {1} 次体重。把它们加入你的个人资料,或保持个人资料与服务器上的完全一致。',
+ '{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '此设备在未登录时记录了 {0} 次训练和 {1} 次体重。把它们加入你的个人资料,或保持个人资料与服务器上的完全一致。',
+ '{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.': '此设备在未登录时记录了 {0} 次训练和 {1} 次体重。把它们加入你的个人资料,或保持个人资料与服务器上的完全一致。',
'Add them': '加入',
'Keep profile as is': '保持不变',
'Offline — your changes are saved on this device and sync when you are back online.': '离线 — 你的更改已保存在此设备上,恢复联网后会自动同步。',
diff --git a/frontend/src/sheets.add-device-data.test.jsx b/frontend/src/sheets.add-device-data.test.jsx
new file mode 100644
index 000000000..1185f0187
--- /dev/null
+++ b/frontend/src/sheets.add-device-data.test.jsx
@@ -0,0 +1,30 @@
+// @vitest-environment happy-dom
+// The sign-in question about entries logged while signed out: a count of one reads in the
+// singular ("1 workout and 1 weigh-in"), per noun, in English and in the packs.
+import { afterEach, describe, expect, it } from 'vitest'
+import { _setLangState } from './lib/i18n-core.js'
+import { addDeviceDataMessage } from './sheets.jsx'
+import de from './locales/de.js'
+import ru from './locales/ru.js'
+
+afterEach(() => _setLangState('en', null, null, null))
+
+describe('addDeviceDataMessage', () => {
+ it('says "1 workout and 1 weigh-in", not "1 workouts and 1 weigh-ins"', () => {
+ _setLangState('en', null, null, null)
+ expect(addDeviceDataMessage(1, 1)).toMatch(/^1 workout and 1 weigh-in were logged/)
+ expect(addDeviceDataMessage(1, 3)).toMatch(/^1 workout and 3 weigh-ins were logged/)
+ expect(addDeviceDataMessage(4, 1)).toMatch(/^4 workouts and 1 weigh-in were logged/)
+ expect(addDeviceDataMessage(2, 5)).toMatch(/^2 workouts and 5 weigh-ins were logged/)
+ expect(addDeviceDataMessage(0, 2)).toMatch(/^0 workouts and 2 weigh-ins were logged/)
+ })
+
+ it('uses the singular sentences of the language packs', () => {
+ _setLangState('de', de, null, null)
+ expect(addDeviceDataMessage(1, 1)).toMatch(/^1 Training und 1 Wiegung wurden/)
+ expect(addDeviceDataMessage(1, 2)).toMatch(/^1 Training und 2 Wiegungen wurden/)
+ expect(addDeviceDataMessage(3, 1)).toMatch(/^3 Trainings und 1 Wiegung wurden/)
+ _setLangState('ru', ru, null, null)
+ expect(addDeviceDataMessage(1, 1)).toMatch(/^1 тренировка и 1 взвешивание/)
+ })
+})
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 2ed88722a..71020da59 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -68,13 +68,25 @@ function ConfirmDialog({ title, message, confirmText, cancelText, danger, onConf
<Button variant="ghost" className="dim" onClick={() => { close(); onCancel && onCancel() }}>{cancelText || t('Cancel')}</Button>
</div>
}
+// "1 workouts and 1 weigh-ins" read wrong: a count of one takes the singular, per noun. Four
+// whole sentences rather than two spliced counts, so every language keeps its own word order.
+export function addDeviceDataMessage(workouts, weighIns) {
+ const one = n => Number(n) === 1
+ return one(workouts)
+ ? one(weighIns)
+ ? t('{0} workout and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.', workouts, weighIns)
+ : t('{0} workout and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.', workouts, weighIns)
+ : one(weighIns)
+ ? t('{0} workouts and {1} weigh-in were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.', workouts, weighIns)
+ : t('{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.', workouts, weighIns)
+}
// Sign-in found workouts on this device that the profile does not have (logged while signed
// out). The profile is the truth — settings and plan come from the server either way — the
// question is only whether these entries are added to it or dropped. Resolves true to add.
export function askAddDeviceData(extras) {
return new Promise(resolve => confirmSheet({
title: t('Add this device\'s workouts to your profile?'),
- message: t('{0} workouts and {1} weigh-ins were logged on this device while signed out. Add them to your profile, or keep the profile exactly as it is on the server.', extras.workouts, extras.bodyweight),
+ message: addDeviceDataMessage(extras.workouts, extras.bodyweight),
confirmText: t('Add them'), cancelText: t('Keep profile as is'),
onConfirm: () => resolve(true), onCancel: () => resolve(false), locked: true
}))
diff --git a/website/about.html b/website/about.html
index 80685b3d2..1ee04032f 100644
--- a/website/about.html
+++ b/website/about.html
@@ -112,7 +112,7 @@
<p>Then friends wanted in. That brought passkey profiles, so everyone signs in with a
fingerprint and keeps their own data, and sync, so the log survives any phone. Somewhere
- along the way the little page was rewritten into a proper React app, learned 14 languages,
+ along the way the little page was rewritten into a proper React app, learned 17 languages,
grew a muscle map that reads three ways (where the volume went, what is still recovering,
and what each muscle is actually strong at), picked up importers for FitNotes, Strong,
Hevy and Apple Health, and finally became a native Android app you can install from
diff --git a/website/api.html b/website/api.html
index eef77f2e2..9a2713946 100644
--- a/website/api.html
+++ b/website/api.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!-- GENERATED FILE - do not edit by hand.
- Built by scripts/build-api-docs.mjs from api/openapi.yaml (openGym API v1.3.8).
+ Built by scripts/build-api-docs.mjs from api/openapi.yaml (openGym API v1.3.9).
Regenerate with: node scripts/build-api-docs.mjs -->
<html lang="en">
<head>
@@ -213,9 +213,12 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<a class="side-link" href="#meta"><b>Meta</b><span>Health &amp; public config</span></a>
<a class="side-link" href="#auth"><b>Auth</b><span>Passkeys &amp; sessions</span></a>
<a class="side-link" href="#pairing"><b>Pairing</b><span>Connect the mobile app</span></a>
+ <a class="side-link" href="#password"><b>Password</b><span>Optional name &amp; password (PASSWORD_LOGIN)</span></a>
+ <a class="side-link" href="#passkeys"><b>Passkeys</b><span>More passkeys &amp; device links</span></a>
<a class="side-link" href="#data"><b>Data</b><span>State sync</span></a>
<a class="side-link" href="#push"><b>Push</b><span>Notifications &amp; rest timer</span></a>
<a class="side-link" href="#activity"><b>Activity</b><span>Live presence</span></a>
+ <a class="side-link" href="#media"><b>Media</b><span>Photos &amp; videos of your exercises &amp; workouts</span></a>
<a class="side-link" href="#coach"><b>AI Coach</b><span>Plans, reviews, debriefs</span></a>
<a class="side-link" href="#admin"><b>Admin</b><span>Users, invites, audit log, Coach</span></a>
<a class="side-link" href="#schemas"><b>Schemas</b><span>The state blob, the error shape &amp; co.</span></a>
@@ -239,8 +242,8 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
<p class="api-facts">
<span>OpenAPI 3.1.0</span>
- <span>openGym v1.3.8</span>
- <span>47 endpoints</span>
+ <span>openGym v1.3.9</span>
+ <span>69 endpoints</span>
<span>AGPL-3.0-or-later</span>
</p>
@@ -255,7 +258,12 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<div class="ov-grid">
<div class="ov">
<h3>Authentication</h3>
-<p>Sign-in is <b>passkey only</b> (WebAuthn, via <code>@simplewebauthn/server</code>). A successful <code>register/verify</code> or <code>login/verify</code> sets the session cookie; every authenticated route then works with that cookie. The paired mobile app has no shared cookie jar, so it redeems a short pairing code (<code>/api/pair/redeem</code>) for the <i>same</i> signed token and sends it as <code>Authorization: Bearer &lt;token&gt;</code> instead.</p>
+<p>Sign-in is by <b>passkey</b> (WebAuthn, via <code>@simplewebauthn/server</code>). A successful <code>register/verify</code> or <code>login/verify</code> sets the session cookie; every authenticated route then works with that cookie. The paired mobile app has no shared cookie jar, so it redeems a short pairing code (<code>/api/pair/redeem</code>) for the <i>same</i> signed token and sends it as <code>Authorization: Bearer &lt;token&gt;</code> instead.</p>
+<p>An instance started with <code>PASSWORD_LOGIN=1</code> also offers <b>name-and-password sign-in</b> (tag <code>password</code>): opt-in per profile, scrypt-hashed, throttled, with an admin-issued one-time reset code instead of e-mail. A profile may also add an e-mail address to sign in with instead of its name (<code>/api/account/email</code>); no mail is ever sent to it. Its routes set exactly the same cookie. With the flag off (the default) every one of them answers 404.</p>
+ </div>
+ <div class="ov">
+ <h3>Throttling</h3>
+<p>The <code>password</code> routes are counted per client address: at most 60 requests a minute across them, and wrong answers (a password, a reset code, an invite code on password signup, an e-mail address already in use) pause the address after 20 for 30 s, doubling up to 15 min. Wrong passwords also pause the <i>account</i> they were tried against after 5, for 1 min doubling up to 1 h — the same pause whether the account was named by its name or its e-mail — and an identifier that names no account is paused the same way, as typed. A password check counts from the moment it starts, so checks sent at once get no more tries than checks sent one by one. A paused caller gets <code>429 {&quot;error&quot;: …, &quot;code&quot;: &quot;locked&quot;, &quot;retryAfter&quot;: &lt;s&gt;}</code> with a <code>Retry-After</code> header. Passkey sign-up and sign-in and the pairing routes are not throttled. The two routes that redeem a one-time device link (tag <code>passkeys</code>) share the per-address budget, and wrong codes pause the address for link redemption only, after 20, the way wrong reset codes do. Adding or removing a passkey in Settings (<code>POST /api/account/passkeys/options</code>, <code>DELETE /api/account/passkeys</code>) and making a device code (<code>POST /api/account/device-link</code>) spend the per-address budget too, and a current password given there as proof counts like one given at sign-in. The address is the socket's, or with <code>TRUST_PROXY=1</code> the one a trusted proxy put in <code>CF-Connecting-IP</code> / the last <code>X-Forwarded-For</code> entry / <code>X-Real-IP</code>; IPv6 clients are counted by /64. Counters live in memory and reset on restart.</p>
</div>
<div class="ov">
<h3>Sessions</h3>
@@ -263,15 +271,15 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
<div class="ov">
<h3>CSRF</h3>
-<p>State-changing browser requests must come from the app's own origin. The server checks <code>Sec-Fetch-Site</code> (falling back to <code>Origin</code> vs the configured <code>ORIGIN</code>); a mismatch is refused with <code>403 {&quot;error&quot;:&quot;cross-origin request refused&quot;}</code> on any non-GET route. Exempt: the WebAuthn and <code>pair/redeem</code> routes (each carries its own one-shot credential in the body) and any request authenticated with a Bearer token.</p>
+<p>State-changing browser requests must come from the app's own origin. The server checks <code>Sec-Fetch-Site</code> (falling back to <code>Origin</code> vs the configured <code>ORIGIN</code>); a mismatch is refused with <code>403 {&quot;error&quot;:&quot;cross-origin request refused&quot;}</code> on any non-GET route. Exempt: passkey sign-up and sign-in (<code>register/options</code>, <code>register/verify</code>, <code>login/options</code>, <code>login/verify</code>) and <code>pair/redeem</code>, each of which carries its own one-shot credential in the body, and any request authenticated with a Bearer token. The password routes are <b>not</b> exempt: a hostile page knows a valid name and password of its own, and could otherwise sign a visitor into it (login CSRF). Neither are the device-link routes: a link is redeemed on the app's own origin, the only one a passkey can be created for.</p>
</div>
<div class="ov">
<h3>Environment-dependent behavior</h3>
-<ul><li><code>INVITE_ONLY=1</code> — registration requires a valid invite code (minted by an admin).</li><li><code>ALLOW_GUEST=0</code> — hides the client-side &quot;continue without account&quot; mode; the server merely reports the flag via <code>GET /api/config</code> (guest mode never talks to this API at all).</li><li><code>ADMIN_UIDS=&lt;uid&gt;,&lt;uid&gt;</code> — user ids treated as admins (a <code>&quot;admin&quot;: true</code> flag on the user record in <code>db.json</code> works too). Admins get the <code>/api/admin/*</code> routes.</li><li><code>AUDIT_LOG</code> (default on), <code>AUDIT_MAX</code> (default 5000 events), <code>AUDIT_DAYS</code> (default 90), <code>AUDIT_IP</code> (<code>off</code> | <code>net</code> | <code>full</code>, default off) — shape the audit log served by <code>GET /api/admin/audit</code>.</li></ul>
+<ul><li><code>INVITE_ONLY=1</code> — registration requires a valid invite code (minted by an admin).</li><li><code>ALLOW_GUEST=0</code> — hides the client-side &quot;continue without account&quot; mode; the server merely reports the flag via <code>GET /api/config</code> (guest mode never talks to this API at all).</li><li><code>ADMIN_UIDS=&lt;uid&gt;,&lt;uid&gt;</code> — user ids treated as admins (a <code>&quot;admin&quot;: true</code> flag on the user record in <code>db.json</code> works too). Admins get the <code>/api/admin/*</code> routes.</li><li><code>AUDIT_LOG</code> (default on), <code>AUDIT_MAX</code> (default 5000 events), <code>AUDIT_DAYS</code> (default 90), <code>AUDIT_IP</code> (<code>off</code> | <code>net</code> | <code>full</code>, default off) — shape the audit log served by <code>GET /api/admin/audit</code>.</li><li><code>PASSWORD_LOGIN=1</code> — adds the <code>password</code> routes and <code>password_login: true</code> in <code>GET /api/config</code>. Off by default.</li><li><code>DEFAULT_LANG</code> (e.g. <code>pt-BR</code>; unset by default) — <code>default_lang</code> in <code>GET /api/config</code>, the language of the sign-in screen and of every profile that never picked one.</li><li><code>TRUST_PROXY=1</code> — the throttle reads the client address from proxy headers (set by the bundled <code>docker-compose.yml</code>, where only the web container can reach the API).</li><li><code>MEDIA_UPLOADS</code> (default on; <code>0</code> removes the <code>media</code> routes and the <code>media</code> block of <code>GET /api/config</code>), <code>MEDIA_QUOTA_MB</code> (200 per profile, <code>0</code> = no cap), <code>MEDIA_IMAGE_MAX_MB</code> (2), <code>MEDIA_GIF_MAX_MB</code> (8), <code>MEDIA_VIDEO_MAX_MB</code> (40), <code>MEDIA_VIDEO_MAX_SEC</code> (60), <code>MEDIA_GC_GRACE_DAYS</code> (14), <code>MEDIA_UPLOADS_PER_HOUR</code> (600 per profile), <code>MEDIA_MIN_FREE_MB</code> (512, <code>0</code> = no floor) — photos and videos of custom exercises (tag <code>media</code>). Every MB here is 2^20 bytes.</li></ul>
</div>
<div class="ov">
<h3>Conventions</h3>
-<ul><li>Every response body is JSON with <code>Cache-Control: no-store</code>.</li><li>Errors are always <code>{&quot;error&quot;: &quot;&lt;human-readable message&gt;&quot;}</code>.</li><li>Unknown method+path pairs return <code>404 {&quot;error&quot;:&quot;not found&quot;}</code>; an unhandled exception returns <code>500 {&quot;error&quot;:&quot;server error&quot;}</code>.</li><li>Request bodies are parsed as JSON regardless of Content-Type. A body that does not parse, or parses to anything but an object (<code>null</code>, a string, an array), is <code>400 {&quot;error&quot;:&quot;invalid json&quot;}</code> on every route that reads one; an empty body counts as <code>{}</code>. A body over 5 MiB is <code>413 {&quot;error&quot;:&quot;body too large&quot;}</code>; the rest of the upload is discarded so the answer reaches the client.</li><li>CORS: the request's <code>Origin</code> is reflected in <code>Access-Control-Allow-Origin</code> <b>without</b> <code>Allow-Credentials</code> — cross-origin callers can only ever authenticate with a Bearer token, never with the cookie.</li></ul>
+<ul><li>Every response body is JSON with <code>Cache-Control: no-store</code>. The one exception is <code>GET /api/media/{hash}</code>, which answers with the stored file itself (<code>Cache-Control: private, no-store</code>).</li><li>Errors are always <code>{&quot;error&quot;: &quot;&lt;human-readable message&gt;&quot;}</code>. The <code>password</code>, throttle and <code>media</code> routes add a stable <code>code</code> for the client to word in its own language.</li><li>Unknown method+path pairs return <code>404 {&quot;error&quot;:&quot;not found&quot;}</code>; an unhandled exception returns <code>500 {&quot;error&quot;:&quot;server error&quot;}</code>.</li><li>Request bodies are parsed as JSON regardless of Content-Type. A body that does not parse, or parses to anything but an object (<code>null</code>, a string, an array), is <code>400 {&quot;error&quot;:&quot;invalid json&quot;}</code> on every route that reads one; an empty body counts as <code>{}</code>. A body over 5 MiB is <code>413 {&quot;error&quot;:&quot;body too large&quot;}</code>; the rest of the upload is discarded so the answer reaches the client.</li><li>CORS: the request's <code>Origin</code> is reflected in <code>Access-Control-Allow-Origin</code> <b>without</b> <code>Allow-Credentials</code> — cross-origin callers can only ever authenticate with a Bearer token, never with the cookie.</li></ul>
</div>
</div>
</section>
@@ -316,7 +324,8 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">Instance configuration</span>
</summary>
<div class="ep-body">
-<p>The flags the login screen needs before anyone is signed in. Both reflect environment variables on the server (<code>INVITE_ONLY</code>, <code>ALLOW_GUEST</code>).</p>
+<p>The flags the login screen needs before anyone is signed in. Both reflect environment variables on the server (<code>INVITE_ONLY</code>, <code>ALLOW_GUEST</code>), and so does <code>password_login</code>, which is there only when <code>PASSWORD_LOGIN=1</code>, and <code>default_lang</code>, which is there only when <code>DEFAULT_LANG</code> is set.</p>
+<p><code>media</code> is there unless the instance runs with <code>MEDIA_UPLOADS=0</code>, for everybody: the caps are not a secret, and its absence is how the app knows this server does not store photos and videos at all.</p>
<p>A caller with a valid session also gets a <code>coach</code> key: the block when the instance has the AI Coach switched on <b>and</b> a provider connected, and <code>null</code> when it has not. A caller with no session gets no key at all — the block names the provider this instance talks to, which is the same fact <code>GET /api/coach/disclosure</code> will not hand out unauthenticated.</p>
<p>The key is always present for a session, <code>null</code> included, so a client that caches this answer can tell &quot;no Coach on this instance&quot; from &quot;you were not signed in when you asked&quot; and knows whether asking again would change it.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
@@ -326,7 +335,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<div class="ptab">
<div class="prow rrow">
<span class="r-code s2">200</span>
- <span class="p-desc">Instance flags, plus the Coach block for a signed-in caller.<span class="r-sig">{ invite_only: boolean, allow_guest: boolean, coach: object | null }</span></span>
+ <span class="p-desc">Instance flags, plus the Coach block for a signed-in caller.<span class="r-sig">{ invite_only: boolean, allow_guest: boolean, coach: object | null, password_login: always true, default_lang: string, media: <a href="#schema-MediaConfig">MediaConfig</a> }</span></span>
</div>
</div>
</div>
@@ -601,43 +610,833 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-desc">A fresh pairing code.<span class="r-sig">{ code: string }</span></span>
</div>
<div class="prow rrow">
- <span class="r-code s4">401</span>
- <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-pairRedeem">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/pair/redeem</code><span class="ep-chip public">public</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Redeem a pairing code for a Bearer token</span>
+ </summary>
+ <div class="ep-body">
+<p>Called from the mobile app with the code shown in the browser. No session required — the code <i>is</i> the credential (one-shot, 5-minute TTL). Returns the same HMAC-signed session token the cookie would carry; the app sends it as <code>Authorization: Bearer &lt;token&gt;</code> from then on. CSRF-exempt.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">code<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The pairing code (case-insensitive).</span>
+ </div>
+</div>
+<pre><code>{
+ &quot;code&quot;: &quot;K7WQ2MZP&quot;
+}</code></pre>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Paired.<span class="r-sig">{ token: string, user: <a href="#schema-SessionUser">SessionUser</a> }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">Code unknown, already used, expired — or the account behind it is gone or disabled (deliberately the same message for all of these).<span class="r-sig"><code>{&quot;error&quot;:&quot;invalid or expired code&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+ </div>
+</section>
+
+<section class="api-sec" id="password">
+ <h2>Password</h2>
+ <p class="sub">Optional name-and-password sign-in (<code>PASSWORD_LOGIN=1</code>). Every route here is a 404 while the flag is off.</p>
+ <div class="eps">
+
+<details class="ep" id="op-loginPassword">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/login/password</code><span class="ep-chip public">public</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Sign in with a profile name or e-mail and a password</span>
+ </summary>
+ <div class="ep-body">
+<p>Only a profile that has set a password can sign in this way. The identifier is the profile's display name or the e-mail address it added (<code>POST /api/account/email</code>), compared trimmed, NFKC-normalised and case-insensitively. Send it as <code>identifier</code> (what the app sends), <code>name</code> (the original field, still accepted) or <code>email</code>. In <code>identifier</code> and <code>name</code>, a value with an <code>@</code> is looked up as an e-mail first and then as a name; <code>email</code> is looked up only as an e-mail. A wrong password, an unknown name and a name whose profile has no password all get the same <code>401</code> after the same scrypt work, so neither the answer nor its timing says which names exist. So does a password that was right when its check started but was changed, reset or removed before the check finished. Five wrong passwords for an account pause it, whichever identifier they named it by (see <i>Throttling</i>); passkey sign-in is never paused by this. Sets the same session cookie as <code>/api/login/verify</code>. <b>Not</b> CSRF-exempt.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">identifier</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">A profile name or an e-mail address.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">name</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The original field: a profile name, or an e-mail address.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">email</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">An e-mail address only.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">password<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string <span class="p-hint">(&le; 256 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Signed in. The session cookie is set.<span class="r-sig">{ user: <a href="#schema-SessionUser">SessionUser</a> } &middot; sets <code>Set-Cookie</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">Name or password missing.<span class="r-sig"><code>{&quot;error&quot;:&quot;name and password required&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">Wrong name or password — deliberately one answer for every cause.<span class="r-sig"><code>{&quot;error&quot;:&quot;wrong name or password&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">The right password for a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;this account has been disabled&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-registerPassword">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/register/password</code><span class="ep-chip public">public</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Create a profile with a name and password</span>
+ </summary>
+ <div class="ep-body">
+<p>For browsers that cannot make a passkey (plain http on a LAN address, some Firefox setups). Creates the profile and signs it in. The same invite rules as passkey registration apply: on an invite-only instance the code is checked first, checked again after hashing, and burned. The password must be 10–256 characters and not one of the passwords guessing scripts try first; no two profiles with a password may share a name. An optional <code>email</code> is stored as the profile's sign-in e-mail (see <code>POST /api/account/email</code>); one that is not an address is refused with <code>400 email-invalid</code>, one that is in use with <code>409 email-taken</code> — asked only after the hash and the second invite check, so without a valid code it is never answered — which counts against the caller's address like a wrong invite code. <b>Not</b> CSRF-exempt.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">name<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string <span class="p-hint">(&le; 40 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">password<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string <span class="p-hint">(&le; 256 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">code</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">Invite code (INVITE_ONLY only).</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">email</span>
+ <span class="p-type">string <span class="p-hint">(&le; 254 chars)</span></span>
+ <span class="p-desc">Optional sign-in e-mail.</span>
+ </div>
+</div>
+<pre><code>{
+ &quot;name&quot;: &quot;Ada&quot;,
+ &quot;password&quot;: &quot;correct horse battery staple&quot;,
+ &quot;code&quot;: &quot;3F9C21A07B54D688&quot;
+}</code></pre>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Registered and signed in. The session cookie is set.<span class="r-sig">{ user: <a href="#schema-SessionUser">SessionUser</a> } &middot; sets <code>Set-Cookie</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The password breaks the policy — <code>too-short</code> (under 10 characters), <code>too-long</code> (over 256) or <code>too-common</code> — a field is <code>missing</code>, or <code>email-invalid</code>: the <code>email</code> given is not an e-mail address.<span class="r-sig"><code>{&quot;error&quot;:&quot;this password is too easy to guess&quot;}</code> &middot; <code>{&quot;error&quot;:&quot;that is not an e-mail address&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">Invite-only and the code is missing, used or revoked.<span class="r-sig"><code>{&quot;error&quot;:&quot;a valid invite code is required&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc"><code>name-taken</code> (see NameTaken) or <code>email-taken</code> — the e-mail is in use by another profile.<span class="r-sig"><code>{&quot;error&quot;:&quot;another profile already uses this e-mail address&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-redeemPasswordReset">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/login/password-reset</code><span class="ep-chip public">public</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Set a new password with an admin's one-time reset code</span>
+ </summary>
+ <div class="ep-body">
+<p>Redeems the code from <code>POST /api/admin/user/password-reset</code> (valid 24 h, single use, stored only as a hash; dashes, spaces and case do not matter) and signs in. A new password that breaks the policy is refused without using up the code. Every other session of the account ends. Wrong codes count against the caller's address only (see <i>Throttling</i>), never against the name, so they cannot keep a real code from working. The profile is named by its name or its sign-in e-mail, in <code>identifier</code>, <code>name</code> or <code>email</code> as at sign-in. <b>Not</b> CSRF-exempt.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">identifier</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The profile name or its sign-in e-mail.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">name</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The original field; an e-mail works here too.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">email</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">code<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">next<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string <span class="p-hint">(&le; 256 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Password set and signed in. The session cookie is set.<span class="r-sig">{ user: <a href="#schema-SessionUser">SessionUser</a> } &middot; sets <code>Set-Cookie</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc"><code>reset-invalid</code> (wrong, used or expired code — one answer for all), <code>missing</code>, or a password-policy code.<span class="r-sig"><code>{&quot;error&quot;:&quot;that reset code is wrong or has expired&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">The account has been disabled.<span class="r-sig"><code>{&quot;error&quot;:&quot;this account has been disabled&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">Another profile already signs in with this name, or holds it with a reset code that has not been used or expired yet.<span class="r-sig"><code>{&quot;error&quot;:&quot;another profile already signs in with this name&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-getAccountPassword">
+ <summary>
+ <span class="m get">GET</span>
+ <span class="ep-path"><code>/api/account/password</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Whether this profile has a password</span>
+ </summary>
+ <div class="ep-body">
+
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The profile's password state.<span class="r-sig">{ set: boolean, setAt: string | null, passkeys: integer, name: string, nameTaken: boolean, email: string | null }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-setAccountPassword">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/password</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Set or change this profile's password</span>
+ </summary>
+ <div class="ep-body">
+<p>Proof first: <code>current</code> when the profile has a password, or a passkey assertion made for this request (<code>cid</code> from <code>POST /api/login/options</code>, <code>credential</code> signed by one of <i>this</i> profile's passkeys) — the only way to set a first password, and the way to replace a forgotten one. A session alone is never enough. Wrong <code>current</code> values count toward the same pause as wrong sign-ins. On success the session version is bumped, which ends every other session and pending pairing code of the account; the caller's own continues on a fresh cookie, or a fresh <code>token</code> for a Bearer caller.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">next<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string <span class="p-hint">(&le; 256 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">current</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">cid</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">credential</span>
+ <span class="p-type"><a href="#schema-WebAuthnAuthenticationCredential">WebAuthnAuthenticationCredential</a></span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Saved. Other sessions have ended.<span class="r-sig">{ ok: always true, token: string } &middot; sets <code>Set-Cookie</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The new password breaks the policy — <code>too-short</code> (under 10 characters), <code>too-long</code> (over 256) or <code>too-common</code> — or a field is <code>missing</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;this password is too easy to guess&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof: <code>current-required</code>, <code>current-wrong</code>, <code>passkey-required</code> (no password yet, so a passkey has to confirm), or <code>passkey</code> (the assertion did not verify or belongs to another profile).<span class="r-sig"><code>{&quot;error&quot;:&quot;your current password is not right&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">Another profile already signs in with this name, or holds it with a reset code that has not been used or expired yet.<span class="r-sig"><code>{&quot;error&quot;:&quot;another profile already signs in with this name&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-removeAccountPassword">
+ <summary>
+ <span class="m delete">DELETE</span>
+ <span class="ep-path"><code>/api/account/password</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Remove this profile's password</span>
+ </summary>
+ <div class="ep-body">
+<p>Refused while the profile has no passkey: the password would be its last way in. Otherwise the body carries the same proof setting one takes — <code>current</code>, the password itself, or a passkey assertion made for this request (<code>cid</code> from <code>POST /api/login/options</code>, <code>credential</code> signed by one of <i>this</i> profile's passkeys). A session alone is never enough: a stolen cookie must not take away the owner's way in where passkeys do not work. The last-way-in refusal comes before the proof is checked, and is checked again after it. Wrong <code>current</code> values count toward the same pause as wrong sign-ins. Existing sessions are left alone (<code>POST /api/logout/all</code> ends them). A profile without a password gets 200 as well, with no proof asked. Audited as <code>auth.password.remove</code>.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body</p><p class="p-desc"><a href="#schema-OwnerProof">OwnerProof</a></p>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Removed (or there was none).<span class="r-sig"><a href="#schema-Ok">Ok</a></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">The password is the profile's only way in.<span class="r-sig"><code>{&quot;error&quot;:&quot;the password is the only way into this profile&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-setAccountEmail">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/email</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Set, change or remove the e-mail this profile may sign in with</span>
+ </summary>
+ <div class="ep-body">
+<p>An e-mail address to type at <code>POST /api/login/password</code> instead of the profile name. No mail is ever sent to it — there is no verification and no reset mail; resets stay the admin's one-time code — so it is only an identifier. Stored trimmed, NFKC-normalised and lower-cased; at most 254 characters; unique across every profile, and never another password-holding profile's name. An empty or null <code>email</code> removes it (as <code>DELETE</code> does).</p>
+<p>The body carries the same proof as setting a password (see OwnerProof): a session alone is never enough. Saving the address the profile already has answers 200 with no proof asked. An address in use by another profile is refused only after the proof, with <code>409 email-taken</code>, and counts against the caller's address and account (20 free, then 30 s doubling to 15 min) — so the answer never costs less than a passkey prompt or a password check, and runs out after a few tries. It says an address is in use somewhere on this instance, never by whom. Audited as <code>auth.email.set</code> / <code>auth.email.change</code> with the address masked (<code>a…@e…</code>).</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p>
+<pre><code>{
+ &quot;email&quot;: &quot;[email protected]&quot;,
+ &quot;current&quot;: &quot;correct horse battery staple&quot;
+}</code></pre>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Saved (or removed).<span class="r-sig">{ ok: always true, email: string | null }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">Not an e-mail address.<span class="r-sig"><code>{&quot;error&quot;:&quot;that is not an e-mail address&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">Another profile already uses this address.<span class="r-sig"><code>{&quot;error&quot;:&quot;another profile already uses this e-mail address&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-removeAccountEmail">
+ <summary>
+ <span class="m delete">DELETE</span>
+ <span class="ep-path"><code>/api/account/email</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Remove the e-mail this profile may sign in with</span>
+ </summary>
+ <div class="ep-body">
+<p>The profile then signs in by its name only. Takes the same proof as setting one (OwnerProof); a profile without an e-mail gets 200 with none asked. Audited as <code>auth.email.remove</code>.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body</p><p class="p-desc"><a href="#schema-OwnerProof">OwnerProof</a></p>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Removed (or there was none).<span class="r-sig">{ ok: always true, email: null }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+ </div>
+</section>
+
+<section class="api-sec" id="passkeys">
+ <h2>Passkeys</h2>
+ <p class="sub">More than one passkey on a profile: list, add, rename, remove — and one-time device links, which let another device of the same person add a passkey of its own.</p>
+ <div class="eps">
+
+<details class="ep" id="op-listPasskeys">
+ <summary>
+ <span class="m get">GET</span>
+ <span class="ep-path"><code>/api/account/passkeys</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">This profile's passkeys</span>
+ </summary>
+ <div class="ep-body">
+<p>Every passkey that signs this profile in, without key material. <code>created</code> and <code>lastUsed</code> are null for a passkey made before they were recorded.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The list, and what it allows.<span class="r-sig"><a href="#schema-PasskeyList">PasskeyList</a></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-removePasskey">
+ <summary>
+ <span class="m delete">DELETE</span>
+ <span class="ep-path"><code>/api/account/passkeys</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Remove one passkey</span>
+ </summary>
+ <div class="ep-body">
+<p>Refused while it is the profile's last way in: its only passkey, and no password that can sign in (a password counts only while <code>PASSWORD_LOGIN</code> is on). Otherwise the body carries the same proof adding one takes (<code>OwnerProof</code>): a session alone is never enough, since a stolen cookie could otherwise choose which of the owner's passkeys is left. Any of the profile's passkeys may confirm, the one being removed included. The 404 and 409 refusals come before the proof is checked, and the last-way-in rule is checked again after it. Audited as <code>auth.passkey.remove</code>. An unused device code of the profile is dropped too, so one made with the removed passkey cannot add another afterwards.</p>
+<p>Sessions are not tied to the passkey that opened them, so a session it already opened carries on; <code>POST /api/logout/all</code> ends those.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+<p class="ep-h">Query parameters</p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">id<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The passkey's <code>id</code> from the list (its WebAuthn credential id).</span>
+ </div>
+</div>
+<p class="ep-h">Request body</p><p class="p-desc"><a href="#schema-OwnerProof">OwnerProof</a></p>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Removed. The list as it is now.<span class="r-sig">object</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">No passkey of this profile has that id.<span class="r-sig"><code>{&quot;error&quot;:&quot;passkey not found&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">It is the profile's last way in.<span class="r-sig"><code>{&quot;error&quot;:&quot;this passkey is the only way into this profile&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-addPasskeyOptions">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/passkeys/options</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Add a passkey (step 1): prove it is you, get creation options</span>
+ </summary>
+ <div class="ep-body">
+<p>A session alone is never enough to add a way in that outlives &quot;sign out everywhere&quot;. The body carries the same proof <code>POST /api/account/password</code> takes: a passkey assertion made for this request (<code>cid</code> from <code>POST /api/login/options</code>, <code>credential</code> signed by one of <i>this</i> profile's passkeys), or <code>current</code>, the profile's password — only while <code>PASSWORD_LOGIN</code> is on. With it off, a password kept from before is not checked at all and the answer is <code>passkey-required</code>, so a password-only profile has to move onto a passkey while the flag is still on. Wrong passwords count toward the sign-in pause.</p>
+<p>The options use the profile's own user handle and list its passkeys in <code>excludeCredentials</code>, so an authenticator that already holds one refuses. The challenge is good for 5 minutes, for this profile, and only while the session version is unchanged.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body</p><p class="p-desc"><a href="#schema-OwnerProof">OwnerProof</a></p>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Ceremony options.<span class="r-sig">{ cid: string, options: <a href="#schema-WebAuthnRegistrationOptions">WebAuthnRegistrationOptions</a> }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">The profile already has the most passkeys it can have (20).<span class="r-sig"><code>{&quot;error&quot;:&quot;a profile can have at most 20 passkeys&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-addPasskeyVerify">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/passkeys/verify</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Add a passkey (step 2): store the new one</span>
+ </summary>
+ <div class="ep-body">
+<p>Verifies the attestation against the challenge from step 1 and stores the passkey on this profile. Audited as <code>auth.passkey.add</code>, with the proof that allowed it.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">cid<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">credential<em class="p-req" title="required">required</em></span>
+ <span class="p-type"><a href="#schema-WebAuthnRegistrationCredential">WebAuthnRegistrationCredential</a></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">name</span>
+ <span class="p-type">string <span class="p-hint">(&le; 40 chars)</span></span>
+ <span class="p-desc">A label of the owner's choosing (&quot;Work laptop&quot;).</span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Added. The list as it is now.<span class="r-sig">object</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">Challenge expired, replayed or made for another profile, or the attestation did not verify.<span class="r-sig"><code>{&quot;error&quot;:&quot;challenge expired — try again&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">Not signed in — including a session that was ended (&quot;sign out everywhere&quot;, a new password) after step 1.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc"><code>credential-exists</code> (that passkey is already registered) or <code>passkey-limit</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;credential already registered&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-renamePasskey">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/passkeys/rename</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Name one passkey</span>
+ </summary>
+ <div class="ep-body">
+<p>An empty name clears it; the app then shows a numbered &quot;Passkey n&quot;.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">id<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">name</span>
+ <span class="p-type">string <span class="p-hint">(&le; 40 chars)</span></span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Renamed. The list as it is now.<span class="r-sig">object</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">No passkey of this profile has that id.<span class="r-sig"><code>{&quot;error&quot;:&quot;passkey not found&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-createDeviceLink">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/account/device-link</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Make a one-time device link</span>
+ </summary>
+ <div class="ep-body">
+<p>For adding another device of the same person: returns a code of 12 characters from the pairing alphabet (60 bits), which the app also shows as a QR code of <code>&lt;app&gt;?link=&lt;code&gt;</code>. The other device redeems it with <code>/api/device-link/*</code> by creating a passkey of its own. The code is shown once, stored only as a SHA-256, good for 10 minutes and for one passkey; a newer one replaces it, and signing out everywhere, a new password, an admin reset or a disable drop it. Same proof as adding a passkey. Audited as <code>auth.link.create</code>.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body</p><p class="p-desc"><a href="#schema-OwnerProof">OwnerProof</a></p>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The code, once.<span class="r-sig">{ code: string, expires: number }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">No acceptable proof that the owner is here: <code>passkey-required</code> (no password that counts — none is set, or <code>PASSWORD_LOGIN</code> is off — so a passkey has to confirm), <code>passkey</code> (the assertion did not verify, belongs to another profile, or was made for another challenge, one handed out for another ceremony or one already used), <code>current-required</code> or <code>current-wrong</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;confirm with your passkey first&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">The profile already has the most passkeys it can have (20).<span class="r-sig"><code>{&quot;error&quot;:&quot;a profile can have at most 20 passkeys&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">503</span>
+ <span class="p-desc">Every password check slot and the short queue behind them are taken.<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is busy — try again in a moment&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-deviceLinkOptions">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/device-link/options</code><span class="ep-chip public">public</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Redeem a device link (step 1): check the code, get creation options</span>
+ </summary>
+ <div class="ep-body">
+<p>Called on the other device, which has no session: the code is the credential. Returns creation options for the profile the code belongs to, and that profile's id and name. Does not use the code up, so a dismissed passkey prompt can be tried again. Wrong codes count toward a per-address pause of link redemption (see <i>Throttling</i>). <b>Not</b> CSRF-exempt.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">code<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">Case, spaces and dashes are ignored.</span>
+ </div>
+</div>
+<pre><code>{
+ &quot;code&quot;: &quot;K7WQ-2MZP-4HXA&quot;
+}</code></pre>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Ceremony options.<span class="r-sig">{ cid: string, options: <a href="#schema-WebAuthnRegistrationOptions">WebAuthnRegistrationOptions</a>, id: string, name: string }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The code is wrong, used, replaced or expired, or its profile is gone or disabled — one answer for all of them.<span class="r-sig"><code>{&quot;error&quot;:&quot;that code is wrong, used or expired&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">The profile already has the most passkeys it can have (20).<span class="r-sig"><code>{&quot;error&quot;:&quot;a profile can have at most 20 passkeys&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
</div>
</div>
</div>
</details>
-<details class="ep" id="op-pairRedeem">
+<details class="ep" id="op-deviceLinkVerify">
<summary>
<span class="m post">POST</span>
- <span class="ep-path"><code>/api/pair/redeem</code><span class="ep-chip public">public</span></span>
+ <span class="ep-path"><code>/api/device-link/verify</code><span class="ep-chip public">public</span></span>
<span class="ep-chev" aria-hidden="true"></span>
- <span class="ep-sum">Redeem a pairing code for a Bearer token</span>
+ <span class="ep-sum">Redeem a device link (step 2): store the passkey and sign this device in</span>
</summary>
<div class="ep-body">
-<p>Called from the mobile app with the code shown in the browser. No session required — the code <i>is</i> the credential (one-shot, 5-minute TTL). Returns the same HMAC-signed session token the cookie would carry; the app sends it as <code>Authorization: Bearer &lt;token&gt;</code> from then on. CSRF-exempt.</p>
+<p>Verifies the attestation against the challenge from step 1 (which must have been made for this very code), stores the passkey on the code's profile, burns the code and sets the session cookie — the passkey just made is what signs the device in. Of two requests racing with one code, one wins. Audited as <code>auth.link.ok</code>, and every refusal as <code>auth.link.fail</code>. <b>Not</b> CSRF-exempt.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Public — no authentication required.</span></p>
<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
<div class="prow">
<span class="p-name">code<em class="p-req" title="required">required</em></span>
<span class="p-type">string</span>
- <span class="p-desc">The pairing code (case-insensitive).</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">cid<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">credential<em class="p-req" title="required">required</em></span>
+ <span class="p-type"><a href="#schema-WebAuthnRegistrationCredential">WebAuthnRegistrationCredential</a></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">name</span>
+ <span class="p-type">string <span class="p-hint">(&le; 40 chars)</span></span>
+ <span class="p-desc"></span>
</div>
</div>
-<pre><code>{
- &quot;code&quot;: &quot;K7WQ2MZP&quot;
-}</code></pre>
<p class="ep-h">Responses</p>
<div class="ptab">
<div class="prow rrow">
<span class="r-code s2">200</span>
- <span class="p-desc">Paired.<span class="r-sig">{ token: string, user: <a href="#schema-SessionUser">SessionUser</a> }</span></span>
+ <span class="p-desc">Added and signed in.<span class="r-sig">{ user: <a href="#schema-SessionUser">SessionUser</a> } &middot; sets <code>Set-Cookie</code></span></span>
</div>
<div class="prow rrow">
<span class="r-code s4">400</span>
- <span class="p-desc">Code unknown, already used, expired — or the account behind it is gone or disabled (deliberately the same message for all of these).<span class="r-sig"><code>{&quot;error&quot;:&quot;invalid or expired code&quot;}</code></span></span>
+ <span class="p-desc"><code>link-invalid</code> (see below), a challenge that expired or was made for another code, or an attestation that did not verify.<span class="r-sig"><code>{&quot;error&quot;:&quot;that code is wrong, used or expired&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc"><code>credential-exists</code> or <code>passkey-limit</code>.<span class="r-sig"><code>{&quot;error&quot;:&quot;credential already registered&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">Paused by the sign-in throttle (see <i>Throttling</i> in the description). The request was not looked at; try again after <code>Retry-After</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;too many attempts — try again later&quot;}</code></span></span>
</div>
</div>
</div>
@@ -686,6 +1485,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<div class="ep-body">
<p>Replaces the stored state wholesale (atomic write; there is no merge on the server). The <code>active</code> field — an in-progress workout — is stripped before saving: a running session belongs to the device running it. Body limit 5 MiB.</p>
<p>With <code>baseRev</code> the write is conditional: it goes through only when <code>baseRev</code> equals the document's current revision, and answers 409 with the current document otherwise — the client merges the two and pushes again with the revision it was given. Without <code>baseRev</code> the write is unconditional (clients from before revisions, and deliberate replaces such as a backup import). The server stamps the new revision into the document as <code>_rev</code>; a <code>_rev</code> sent by the client is ignored.</p>
+<p>Every accepted write also starts the grace period of each stored file (tag <code>media</code>) the new state no longer references, and stops it for each one it references again. That bookkeeping never changes the answer.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
@@ -1065,6 +1865,181 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
</section>
+<section class="api-sec" id="media">
+ <h2>Media</h2>
+ <p class="sub">The photo, GIF or video of a user's own custom exercise, and the photos and videos attached to a logged workout. Stored per profile (one quota for both) and named by the SHA-256 of its bytes; the state only carries a <code>MediaRef</code>. Every route here is a 404 when the instance runs with <code>MEDIA_UPLOADS=0</code>.</p>
+ <div class="eps">
+
+<details class="ep" id="op-getMedia">
+ <summary>
+ <span class="m get">GET</span>
+ <span class="ep-path"><code>/api/media/{hash}</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Download one of your photos or videos</span>
+ </summary>
+ <div class="ep-body">
+<p>The stored file, whole, from the caller's own folder only: another profile's file answers exactly like one that was never uploaded (404). The body is the file, not JSON, with headers that keep a browser from ever treating it as a page: <code>Content-Type</code> from the sniffed type (never <code>text/*</code> or SVG), <code>X-Content-Type-Options: nosniff</code>, <code>Content-Security-Policy: default-src 'none'; sandbox</code>, <code>Cross-Origin-Resource-Policy: same-origin</code>, <code>Content-Disposition: inline</code>, <code>X-Robots-Tag: noindex</code> and <code>Cache-Control: private, no-store</code> — the app keeps its own verified copy, and an HTTP-cache copy would outlive signing out.</p>
+<p>No <code>Range</code> and no <code>ETag</code>: the app downloads a file once, checks it against its hash and keeps it. A paired phone fetches with its bearer token; <code>&lt;img src&gt;</code> cannot carry one. Not throttled.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The file.<span class="r-sig">sets <code>Content-Length</code>, <code>Content-Disposition</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">Not in the caller's folder — never uploaded, removed by the sweep, or someone else's.<span class="r-sig"><code>{&quot;error&quot;:&quot;no such file&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-putMedia">
+ <summary>
+ <span class="m put">PUT</span>
+ <span class="ep-path"><code>/api/media/{hash}</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Upload one photo, GIF or video</span>
+ </summary>
+ <div class="ep-body">
+<p>The body is the raw file; <code>Content-Type</code> must be one of the seven types below and <code>Content-Length</code> is optional (chunked uploads are capped while they stream). The path names the SHA-256 of the bytes, and the file is stored only if they hash to it. Idempotent: uploading a file the server already has answers 200 with <code>existed: true</code>.</p>
+<p>What is stored is decided by the file's first bytes, not by the declared type. The declared type only has to be in the same category — a still (JPEG, PNG, WebP, GIF) or a video (MP4, MOV, WebM): a JPEG declared as a GIF is stored as the JPEG it is, a video declared as an image is refused. The cap of the kind the bytes turned out to be applies (<code>MEDIA_IMAGE_MAX_MB</code>, <code>MEDIA_GIF_MAX_MB</code>, <code>MEDIA_VIDEO_MAX_MB</code>), and an MP4 or MOV must be a well-formed file no longer than <code>MEDIA_VIDEO_MAX_SEC</code> (+1 s), read from its headers. HEIC/AVIF, SVG, HTML and every other type are refused; the app converts HEIC photos before uploading. The server never decodes or alters a file: the app has already re-encoded photos and removed video metadata on the device.</p>
+<p>Checked in this order: session (401), the hourly budget and at most two uploads at once per profile (429), the declared type (415), a declared length over the cap (413 before a byte is read), already stored (200), the quota (413 <code>media-quota</code>; files the profile already dropped get one hour instead of the grace to make room), free disk (507), then while and after streaming: size (413), hash (400), sniffed type (415), sniffed cap (413), video checks (415/413). No bytes for 60 s ends the upload with 408. A refused upload is read and discarded up to twice its cap, so the answer reaches the client.</p>
+<p>A new file that the profile's state does not reference yet starts its grace period at once, so a state push that never comes does not keep it forever.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The server already had these bytes (from this or another of your devices).<span class="r-sig"><a href="#schema-MediaStored">MediaStored</a></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s2">201</span>
+ <span class="p-desc">Stored.<span class="r-sig"><a href="#schema-MediaStored">MediaStored</a></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The bytes do not hash to the name in the path (<code>hash-mismatch</code>).<span class="r-sig"><code>{&quot;error&quot;:&quot;the file does not match its name&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">A browser request from another origin (see <i>CSRF</i>).<span class="r-sig"><code>{&quot;error&quot;:&quot;cross-origin request refused&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">408</span>
+ <span class="p-desc">No bytes arrived for 60 seconds (<code>timeout</code>). The connection is closed.<span class="r-sig"><code>{&quot;error&quot;:&quot;the upload stalled&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">413</span>
+ <span class="p-desc">- <code>media-too-large</code> — over the cap of its kind; <code>maxMB</code> says the cap. - <code>media-quota</code> — the profile's space is full; <code>usedMB</code> and <code>quotaMB</code> say how full. - <code>media-too-long</code> — a video longer than <code>maxSec</code> seconds.<span class="r-sig"><code>{&quot;error&quot;:&quot;that file is too large&quot;}</code> &middot; <code>{&quot;error&quot;:&quot;your space for photos and videos is full&quot;}</code> &middot; <code>{&quot;error&quot;:&quot;that video is too long&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">415</span>
+ <span class="p-desc"><code>media-type</code> — the declared type is not one of the seven, the bytes are none of them, or they are a video declared as an image (or the reverse). <code>media-invalid</code> — an MP4 or MOV whose boxes do not add up.<span class="r-sig"><code>{&quot;error&quot;:&quot;that file type is not accepted&quot;}</code> &middot; <code>{&quot;error&quot;:&quot;that video could not be read&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc"><code>locked</code> — more than <code>MEDIA_UPLOADS_PER_HOUR</code> uploads this hour; <code>busy</code> — two uploads of this profile are already in flight (<code>retryAfter</code> 5).<span class="r-sig"><code>{&quot;error&quot;:&quot;too many uploads — try again later&quot;}</code> &middot; <code>{&quot;error&quot;:&quot;too many uploads at once — try again in a moment&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s5">507</span>
+ <span class="p-desc">The server's disk has less than <code>MEDIA_MIN_FREE_MB</code> free (<code>storage-full</code>).<span class="r-sig"><code>{&quot;error&quot;:&quot;the server is running out of disk space&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-mediaMissing">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/media/missing</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Which of these files the server does not have</span>
+ </summary>
+ <div class="ep-body">
+<p>The app sends every hash its state references and uploads only what comes back, so the same call moves a guest's files into a new account, a phone's into its pairing, a backup's into the server, and re-sends a file the sweep removed while a device still had it. Answered from the caller's own folder only.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">hashes<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string[]</span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The subset the server does not have, in the order sent, and the profile's usage.<span class="r-sig">{ missing: string[], usage: <a href="#schema-MediaUsage">MediaUsage</a> }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc"><code>hashes</code> is missing, not a list, longer than 1000, or holds something that is not a lowercase SHA-256 (<code>bad-request</code>).</span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">A browser request from another origin (see <i>CSRF</i>).<span class="r-sig"><code>{&quot;error&quot;:&quot;cross-origin request refused&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-mediaSweep">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/media/sweep</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Delete every file your current state does not reference</span>
+ </summary>
+ <div class="ep-body">
+<p>What &quot;Reset everything&quot; does after pushing the empty state: every stored file of the caller that the stored state does not reference goes now, without the grace period. A state that cannot be read removes nothing. At most 10 an hour per profile (429 <code>locked</code>). Recorded in the activity log as <code>media.sweep</code>.</p>
+<p>Without this call nothing is lost either: the hourly sweep removes a file once the state has not referenced it for <code>MEDIA_GC_GRACE_DAYS</code> days (14), and only for profiles whose state reads — a missing or unreadable state, or a profile missing from <code>db.json</code>, never deletes anything.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer &lt;token&gt;</code> from mobile-app pairing.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p>
+<pre><code>{}</code></pre>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">What was removed, and what is left.<span class="r-sig">{ removed: integer, freedBytes: integer, usage: <a href="#schema-MediaUsage">MediaUsage</a> }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">A browser request from another origin (see <i>CSRF</i>).<span class="r-sig"><code>{&quot;error&quot;:&quot;cross-origin request refused&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">429</span>
+ <span class="p-desc">More than 10 sweeps this hour (<code>locked</code>).<span class="r-sig"><code>{&quot;error&quot;:&quot;too many uploads — try again later&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+ </div>
+</section>
+
<section class="api-sec" id="coach">
<h2>AI Coach</h2>
<p class="sub">AI Coach — plans, reviews and debriefs. Every route here answers 503 unless the instance has the Coach switched on and a provider connected.</p>
@@ -1149,6 +2124,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">string <span class="p-hint">(&le; 4000 chars)</span></span>
<span class="p-desc">A change asked for in plain words, applied to the proposal now waiting. Cut to the instance's <code>maxMessageLen</code> (1000 unless the admin changed it; 200–4000).</span>
</div>
+ <div class="prow">
+ <span class="p-name">lang</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The language the app is showing, which the Coach writes in. Absent or not a language tag, the profile's stored <code>lang</code> is used.</span>
+ </div>
</div>
<pre><code>{
&quot;intake&quot;: {
@@ -1208,6 +2188,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">string <span class="p-hint">(&le; 4000 chars)</span></span>
<span class="p-desc">Anything the profile wants the Coach to know this time round. Cut to the instance's <code>maxMessageLen</code> (1000 unless the admin changed it; 200–4000).</span>
</div>
+ <div class="prow">
+ <span class="p-name">lang</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The language the app is showing, which the Coach writes in. Absent or not a language tag, the profile's stored <code>lang</code> is used.</span>
+ </div>
</div>
<p class="ep-h">Responses</p>
<div class="ptab">
@@ -1256,6 +2241,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">string <span class="p-hint">(&le; 40 chars)</span> | null</span>
<span class="p-desc">The workout to read; null or absent means the latest.</span>
</div>
+ <div class="prow">
+ <span class="p-name">lang</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The language the app is showing, which the Coach writes in. Absent or not a language tag, the profile's stored <code>lang</code> is used.</span>
+ </div>
</div>
<p class="ep-h">Responses</p>
<div class="ptab">
@@ -1463,6 +2453,54 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<p class="sub">Admin dashboard — requires an admin session (<code>ADMIN_UIDS</code> or <code>admin:true</code>)</p>
<div class="eps">
+<details class="ep" id="op-adminPasswordReset">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/admin/user/password-reset</code><span class="ep-chip admin">admin</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Issue a one-time password reset code</span>
+ </summary>
+ <div class="ep-body">
+<p>Returns a code (12 characters from the pairing alphabet, 60 bits) that is shown once, stored only as a SHA-256, valid for 24 h and good for one <code>POST /api/login/password-reset</code>. Issuing it removes the profile's current password and bumps its session version (every session and pending pairing code ends); passkeys keep working. A newer code replaces an older one. Admin accounts are refused — an admin sets their own password in Settings. Audited as <code>admin.password.reset</code>.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only — a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">id<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The user id.</span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">The code, once.<span class="r-sig">{ ok: always true, name: string, code: string, expires: number }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The target is an admin.<span class="r-sig"><code>{&quot;error&quot;:&quot;an admin sets their own password in Settings&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">Signed in, but not an admin. The attempt is recorded in the audit log.<span class="r-sig"><code>{&quot;error&quot;:&quot;forbidden&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">No user with that id.<span class="r-sig"><code>{&quot;error&quot;:&quot;no such user&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">409</span>
+ <span class="p-desc">Another profile already signs in with this name, or holds it with a reset code that has not been used or expired yet.<span class="r-sig"><code>{&quot;error&quot;:&quot;another profile already signs in with this name&quot;}</code></span></span>
+ </div>
+ </div>
+ </div>
+</details>
+
<details class="ep" id="op-adminUsers">
<summary>
<span class="m get">GET</span>
@@ -1479,7 +2517,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<div class="ptab">
<div class="prow rrow">
<span class="r-code s2">200</span>
- <span class="p-desc">All users.<span class="r-sig">{ users: <a href="#schema-AdminUserRow">AdminUserRow</a>[], invite_only: boolean, now: number }</span></span>
+ <span class="p-desc">All users.<span class="r-sig">{ users: <a href="#schema-AdminUserRow">AdminUserRow</a>[], invite_only: boolean, password_login: boolean, now: number }</span></span>
</div>
<div class="prow rrow">
<span class="r-code s4">401</span>
@@ -1501,7 +2539,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">One user in detail</span>
</summary>
<div class="ep-body">
-<p>Drill-down — full workout history (newest first) and body-weight log for one user. Admin only. Anything in <code>routines</code>, <code>bodyweight</code> or <code>workouts</code> that is not an object is left out, and a list that is not an array reads as empty: PUT /api/data drops those entries now, but a state file written before it did still has them and this route has to answer for it.</p>
+<p>Drill-down — full workout history (newest first) and body-weight log for one user. Admin only. Anything in <code>routines</code>, <code>bodyweight</code> or <code>workouts</code> that is not an object is left out, and a list that is not an array reads as empty: PUT /api/data drops those entries now, but a state file written before it did still has them and this route has to answer for it. A workout's <code>media</code> (its photos and videos) is left out: they are the owner's own.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only — a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
<p class="ep-h">Query parameters</p><div class="ptab">
<div class="prow">
@@ -1590,7 +2628,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">Delete a user and everything of theirs</span>
</summary>
<div class="ep-body">
-<p>Removes the account for good: the user record, their passkeys, their push subscriptions, their live presence, their training history file and any Coach credential stored for them. Not reversible — <code>/api/admin/user/disable</code> is the reversible one. An admin cannot delete their own account, and the last admin cannot be deleted. Audited by name, since the id stops meaning anything.</p>
+<p>Removes the account for good: the user record, their passkeys, their push subscriptions, their live presence, their training history file, their uploaded photos and videos (<code>DATA_DIR/uploads/&lt;uid&gt;/</code>) and any Coach credential stored for them. Not reversible — <code>/api/admin/user/disable</code> is the reversible one. An admin cannot delete their own account, and the last admin cannot be deleted. Audited by name, since the id stops meaning anything.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only — a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
@@ -2090,22 +3128,68 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="r-code s4">403</span>
<span class="p-desc">Signed in, but not an admin. The attempt is recorded in the audit log.<span class="r-sig"><code>{&quot;error&quot;:&quot;forbidden&quot;}</code></span></span>
</div>
- </div>
+ </div>
+ </div>
+</details>
+ </div>
+</section>
+
+ <section class="api-sec" id="schemas">
+ <h2>Schemas</h2>
+ <p class="sub">The named shapes the endpoints above link to. The <code>State</code> blob
+ is <b>representative, not enforced</b> — the server stores it opaquely and the app
+ grows it over time.</p>
+ <div class="eps">
+
+<details class="ep sch" id="schema-Error">
+ <summary>
+ <span class="sch-name"><code>Error</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum"></span>
+ </summary>
+ <div class="ep-body">
+
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">error<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">Human-readable message. This is the only error shape the API has.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">code</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">A stable reason on the password, throttle and media routes, for a client to word in its own language (<code>bad-credentials</code>, <code>locked</code>, <code>too-short</code>, <code>media-quota</code>, …). Media refusals add the numbers to word it with (<code>maxMB</code>, <code>maxSec</code>, <code>usedMB</code>, <code>quotaMB</code>).</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">retryAfter</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc">429 only — the same number of seconds as the Retry-After header.</span>
+ </div>
+</div>
+ </div>
+</details>
+
+<details class="ep sch" id="schema-Ok">
+ <summary>
+ <span class="sch-name"><code>Ok</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum"></span>
+ </summary>
+ <div class="ep-body">
+
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">ok</span>
+ <span class="p-type">always true</span>
+ <span class="p-desc"></span>
+ </div>
+</div>
</div>
</details>
- </div>
-</section>
-
- <section class="api-sec" id="schemas">
- <h2>Schemas</h2>
- <p class="sub">The named shapes the endpoints above link to. The <code>State</code> blob
- is <b>representative, not enforced</b> — the server stores it opaquely and the app
- grows it over time.</p>
- <div class="eps">
-<details class="ep sch" id="schema-Error">
+<details class="ep sch" id="schema-PasskeyList">
<summary>
- <span class="sch-name"><code>Error</code></span>
+ <span class="sch-name"><code>PasskeyList</code></span>
<span class="ep-chev" aria-hidden="true"></span>
<span class="ep-sum"></span>
</summary>
@@ -2113,26 +3197,71 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<div class="ptab">
<div class="prow">
- <span class="p-name">error<em class="p-req" title="required">required</em></span>
+ <span class="p-name">passkeys</span>
+ <span class="p-type">object[]</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">passkeys[].id</span>
<span class="p-type">string</span>
- <span class="p-desc">Human-readable message. This is the only error shape the API has.</span>
+ <span class="p-desc">WebAuthn credential id (base64url).</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">passkeys[].name</span>
+ <span class="p-type">string | null</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">passkeys[].created</span>
+ <span class="p-type">string | null</span>
+ <span class="p-desc">ISO timestamp.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">passkeys[].lastUsed</span>
+ <span class="p-type">string | null</span>
+ <span class="p-desc">ISO timestamp of the last sign-in or confirmation with it.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">passkeys[].transports</span>
+ <span class="p-type">string[]</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">password</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">The profile has a password and <code>PASSWORD_LOGIN</code> is on, so <code>current</code> can prove an addition or a removal.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">lastWayIn</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">Removing any one passkey would be refused (409 <code>last-way-in</code>).</span>
</div>
</div>
</div>
</details>
-<details class="ep sch" id="schema-Ok">
+<details class="ep sch" id="schema-OwnerProof">
<summary>
- <span class="sch-name"><code>Ok</code></span>
+ <span class="sch-name"><code>OwnerProof</code></span>
<span class="ep-chev" aria-hidden="true"></span>
- <span class="ep-sum"></span>
+ <span class="ep-sum">Either a passkey assertion made for this request (<code>cid</code> + <code>credential</code>), or the profile's current password (<code>current</code>) — which counts only while <code>PASSWORD_LOGIN</code> is on.</span>
</summary>
<div class="ep-body">
-
+<p>Each assertion is good for one request: its challenge is spent by it.</p>
<div class="ptab">
<div class="prow">
- <span class="p-name">ok</span>
- <span class="p-type">always true</span>
+ <span class="p-name">cid</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">From POST /api/login/options.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">credential</span>
+ <span class="p-type"><a href="#schema-WebAuthnAuthenticationCredential">WebAuthnAuthenticationCredential</a></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">current</span>
+ <span class="p-type">string</span>
<span class="p-desc"></span>
</div>
</div>
@@ -2445,7 +3574,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
<div class="prow">
<span class="p-name">customEx</span>
- <span class="p-type">object[]</span>
+ <span class="p-type"><a href="#schema-CustomExercise">CustomExercise</a>[]</span>
<span class="p-desc">User-created exercises (id, name, muscles…).</span>
</div>
<div class="prow">
@@ -2497,6 +3626,251 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
</details>
+<details class="ep sch" id="schema-CustomExercise">
+ <summary>
+ <span class="sch-name"><code>CustomExercise</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">One exercise the user made (representative shape).</span>
+ </summary>
+ <div class="ep-body">
+<p>The server stores it as sent and reads only <code>media</code> from it, to know which uploaded files are still referenced.</p>
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">id</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">n</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">Name.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">bp</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">Body part.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">custom</span>
+ <span class="p-type">always true</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">media</span>
+ <span class="p-type"><a href="#schema-MediaRef">MediaRef</a></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">url</span>
+ <span class="p-type">string <span class="p-hint">(uri, &le; 2048 chars)</span></span>
+ <span class="p-desc">One link — a video or a guide. http(s) only, no credentials. Neither the app nor the server ever fetches it: the app opens it in a new browsing context on a tap.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">_ts</span>
+ <span class="p-type">number</span>
+ <span class="p-desc">When this entry was last edited, ms — for merging two devices' copies.</span>
+ </div>
+</div>
+ </div>
+</details>
+
+<details class="ep sch" id="schema-MediaRef">
+ <summary>
+ <span class="sch-name"><code>MediaRef</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">What the state knows of an uploaded file.</span>
+ </summary>
+ <div class="ep-body">
+<p>The bytes are behind <code>GET /api/media/{hash}</code>; the server keeps a file as long as some <code>customEx[].media.hash</code>, <code>workouts[].media[].hash</code> or <code>.poster.hash</code> of either in the profile's state names it, and for <code>MEDIA_GC_GRACE_DAYS</code> after.</p>
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">kind<em class="p-req" title="required">required</em></span>
+ <span class="p-type">&quot;image&quot; | &quot;gif&quot; | &quot;video&quot;</span>
+ <span class="p-desc"><code>gif</code> means animated; a one-frame GIF is an <code>image</code>.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">hash<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">SHA-256 of the stored file.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">mime<em class="p-req" title="required">required</em></span>
+ <span class="p-type">&quot;image/webp&quot; | &quot;image/jpeg&quot; | &quot;image/png&quot; | &quot;image/gif&quot; | &quot;video/mp4&quot; | &quot;video/quicktime&quot; | &quot;video/webm&quot;</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">size<em class="p-req" title="required">required</em></span>
+ <span class="p-type">integer <span class="p-hint">(1&ndash;)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">width<em class="p-req" title="required">required</em></span>
+ <span class="p-type">integer <span class="p-hint">(1&ndash;16384)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">height<em class="p-req" title="required">required</em></span>
+ <span class="p-type">integer <span class="p-hint">(1&ndash;16384)</span></span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">dur</span>
+ <span class="p-type">number <span class="p-hint">(0&ndash;3600)</span></span>
+ <span class="p-desc">Seconds, one decimal; videos and animated GIFs, absent when unknown.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">codec</span>
+ <span class="p-type">&quot;avc1&quot; | &quot;hvc1&quot; | &quot;av01&quot; | &quot;vp09&quot; | &quot;vp8&quot; | &quot;vp9&quot; | &quot;other&quot;</span>
+ <span class="p-desc">Videos only.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster</span>
+ <span class="p-type">object</span>
+ <span class="p-desc">A still of at most 480 px — always for images and GIFs, when possible for videos.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster.hash</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster.mime</span>
+ <span class="p-type">&quot;image/webp&quot; | &quot;image/jpeg&quot;</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster.size</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster.width</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">poster.height</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">at<em class="p-req" title="required">required</em></span>
+ <span class="p-type">number</span>
+ <span class="p-desc">When it was attached</span>
+ </div>
+</div>
+ </div>
+</details>
+
+<details class="ep sch" id="schema-MediaConfig">
+ <summary>
+ <span class="sch-name"><code>MediaConfig</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">The instance's media caps (<code>MEDIA_*</code>), in MB of 2^20 bytes.</span>
+ </summary>
+ <div class="ep-body">
+<p>Absent when the instance runs with <code>MEDIA_UPLOADS=0</code>.</p>
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">imageMB</span>
+ <span class="p-type">number</span>
+ <span class="p-desc">A photo after the app re-encoded it, or a poster.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">gifMB</span>
+ <span class="p-type">number</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">videoMB</span>
+ <span class="p-type">number</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">videoSec</span>
+ <span class="p-type">number</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">quotaMB</span>
+ <span class="p-type">number</span>
+ <span class="p-desc">Per profile; 0 = no cap.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">workouts</span>
+ <span class="p-type">always true</span>
+ <span class="p-desc">This instance keeps the files a logged workout's <code>media</code> list names too, not only a custom exercise's. Absent on an instance from before; the app then offers photos and videos on custom exercises only.</span>
+ </div>
+</div>
+ </div>
+</details>
+
+<details class="ep sch" id="schema-MediaUsage">
+ <summary>
+ <span class="sch-name"><code>MediaUsage</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum"></span>
+ </summary>
+ <div class="ep-body">
+
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">bytes</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc">What the profile's stored files take.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">count</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">quotaBytes</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc">The cap; 0 = no cap.</span>
+ </div>
+</div>
+ </div>
+</details>
+
+<details class="ep sch" id="schema-MediaStored">
+ <summary>
+ <span class="sch-name"><code>MediaStored</code></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum"></span>
+ </summary>
+ <div class="ep-body">
+
+<div class="ptab">
+ <div class="prow">
+ <span class="p-name">ok</span>
+ <span class="p-type">always true</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">hash</span>
+ <span class="p-type">string</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">mime</span>
+ <span class="p-type">string</span>
+ <span class="p-desc">What the bytes are — not necessarily what was declared.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">size</span>
+ <span class="p-type">integer</span>
+ <span class="p-desc"></span>
+ </div>
+ <div class="prow">
+ <span class="p-name">existed</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">The server already had this file.</span>
+ </div>
+</div>
+ </div>
+</details>
+
<details class="ep sch" id="schema-Workout">
<summary>
<span class="sch-name"><code>Workout</code></span>
@@ -2596,6 +3970,16 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">number</span>
<span class="p-desc"></span>
</div>
+ <div class="prow">
+ <span class="p-name">media</span>
+ <span class="p-type"><a href="#schema-MediaRef">MediaRef</a>[]</span>
+ <span class="p-desc">Photos and videos attached to this workout (a progress photo, a form-check clip) — at most six in the app. Refs only; the bytes are behind <code>/api/media/{hash}</code>, and the server keeps every file any entry here names (the GC walks this list as it walks each custom exercise's <code>media</code>).</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">_ts</span>
+ <span class="p-type">number</span>
+ <span class="p-desc">When this workout was last edited after it was logged, ms — for merging two devices' copies.</span>
+ </div>
</div>
</div>
</details>
@@ -2758,6 +4142,16 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type"><a href="#schema-Presence">Presence</a> | null</span>
<span class="p-desc">Currently training, or null.</span>
</div>
+ <div class="prow">
+ <span class="p-name">password</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">PASSWORD_LOGIN instances only — the profile has a password.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">email</span>
+ <span class="p-type">string | null</span>
+ <span class="p-desc">PASSWORD_LOGIN instances only — the e-mail the profile signs in with, if any.</span>
+ </div>
</div>
</div>
</details>
@@ -2854,6 +4248,21 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">string | null</span>
<span class="p-desc"></span>
</div>
+ <div class="prow">
+ <span class="p-name">user.password</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">PASSWORD_LOGIN instances only.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">user.email</span>
+ <span class="p-type">string | null</span>
+ <span class="p-desc">PASSWORD_LOGIN instances only — the sign-in e-mail, if any.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">user.resetUntil</span>
+ <span class="p-type">number | null</span>
+ <span class="p-desc">PASSWORD_LOGIN instances only — expiry (ms) of an unused reset code.</span>
+ </div>
<div class="prow">
<span class="p-name">unit</span>
<span class="p-type">&quot;kg&quot; | &quot;lb&quot;</span>
diff --git a/website/docs.html b/website/docs.html
index 406b5ae13..ef96bc0eb 100644
--- a/website/docs.html
+++ b/website/docs.html
@@ -422,10 +422,10 @@
<ul>
<li><b>Light/dark themes and 8 accent colors</b>, saved to your profile, over a
hand-drawn icon set instead of emoji — it looks the same on every phone.</li>
- <li><b>14 languages</b> — EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU,
- ZH, KO, HI, TH, HU. Exercise instructions are localized in 12 of them, and built-in
- exercise names show bilingually in PT-BR and HU. Translations load on demand, so the
- app stays fast.</li>
+ <li><b>17 languages</b> — EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU,
+ UK, ZH, KO, HI, TH, HU, AR, with Arabic laid out right to left. Exercise instructions
+ are localized in 12 of them, and built-in exercise names are translated in seven
+ (PT-BR, HU, DE, ES, RU, IT, FR). Translations load on demand, so the app stays fast.</li>
<li><b>kg or lb</b> — pick your unit; imports convert.</li>
<li><b>Workout-day reminder:</b> an optional notification on days you have a workout
planned but haven't logged one. It fires at <i>your</i> local time — each device
diff --git a/website/index.html b/website/index.html
index c6e712a3c..a2967f3e5 100644
--- a/website/index.html
+++ b/website/index.html
@@ -51,8 +51,8 @@ try {
"url":"https://opengym.duarte-santos.ch/",
"image":"https://opengym.duarte-santos.ch/img/social.jpg",
"screenshot":["https://opengym.duarte-santos.ch/img/home.png","https://opengym.duarte-santos.ch/img/workout.png","https://opengym.duarte-santos.ch/img/stats.png"],
- "softwareVersion":"1.3.8","datePublished":"2026-07-18","dateModified":"2026-09-20","isAccessibleForFree":true,
- "featureList":["Weekly plan with a routine per weekday","Guided workouts with rest timer, supersets, warm-up and timed sets","Progression rules: linear, Greyskull LP, double progression","Estimated 1RM, activity heatmap, muscle balance and fatigue maps","Body-weight tracking with a goal line","Import from Hevy, Strong, FitNotes and Apple Health","Passkey login and multi-device sync when self-hosted","Standalone Android APK with no account","14 languages","Optional AI coach on your own API key"],
+ "softwareVersion":"1.3.9","datePublished":"2026-07-18","dateModified":"2026-09-28","isAccessibleForFree":true,
+ "featureList":["Weekly plan with a routine per weekday","Guided workouts with rest timer, supersets, warm-up and timed sets","Progression rules: linear, Greyskull LP, double progression","Estimated 1RM, activity heatmap, muscle balance and fatigue maps","Body-weight tracking with a goal line","Import from Hevy, Strong, FitNotes and Apple Health","Passkey login and multi-device sync when self-hosted","Standalone Android APK with no account","17 languages, including Arabic right-to-left","Optional AI coach on your own API key"],
"downloadUrl":"https://opengym.duarte-santos.ch/openGym.apk",
"author":{"@type":"Person","name":"Duarte Santos","url":"https://duarte-santos.ch"},
"sameAs":["https://github.com/DuarteSantos8/openGym","https://gitlab.com/DuarteSantos8/opengym","https://discord.gg/e62jY6fwVb"]}
@@ -318,13 +318,13 @@ try {
</article>
<article class="fcard">
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-globe"/></svg></span>
- <b class="fcard-t">14 languages</b>
- <span class="fcard-b">The full interface, plus exercise instructions in 12 languages and bilingual Brazilian Portuguese and Hungarian names, all loaded on demand.</span>
+ <b class="fcard-t">17 languages</b>
+ <span class="fcard-b">The full interface, Arabic right to left, exercise instructions in 12 languages and translated exercise names in seven, all loaded on demand.</span>
</article>
<article class="fcard">
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-key"/></svg></span>
<b class="fcard-t">Passkeys, not passwords</b>
- <span class="fcard-b">Self-hosted profiles sign in with Face ID or a fingerprint. Everyone’s data stays their own.</span>
+ <span class="fcard-b">Self-hosted profiles sign in with Face ID or a fingerprint, on as many devices as they like. A password is there if the instance switches it on. Everyone’s data stays their own.</span>
<a class="fcard-link" href="docs.html#selfhost">Self-hosting guide →</a>
</article>
<article class="fcard">
@@ -420,7 +420,7 @@ try {
</ul>
<div class="push">
<a class="btn" href="openGym.apk" download>Download for Android</a>
- <p class="meta">v1.3.8 · 27.7 MB · Android 6.0+ · signed APK. Your browser will ask
+ <p class="meta">v1.3.9 · 27.7 MB · Android 6.0+ · signed APK. Your browser will ask
before installing; that is normal outside the Play Store.</p>
<p class="meta">Every release is also built and signed by CI and attached to the
<a href="https://github.com/DuarteSantos8/openGym/releases" rel="noopener">GitHub
@@ -479,7 +479,7 @@ try {
<div><b data-gh="issues-n">–</b><span>open issues</span></div>
<div><b data-dc="members-n">–</b><span>on Discord</span></div>
<div><b>1,324</b><span>exercises</span></div>
- <div><b>13</b><span>languages</span></div>
+ <div><b>17</b><span>languages</span></div>
</div>
</div>