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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
v1.3.5: own API key on the phone no longer hangs (secure-storage plugin handed to a promise as a thenable)
Duarte Santos684b0054adfc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f70994a56..d827d8703 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,22 @@# Changelog+## v1.3.5 — 2026-09-06++One bug, and the one everybody with the Android app and their own API key ran into. Web bundle and+APK; the API only carries the version number.++- 🔑 **"Bring my own API key" works on the phone.** Since v1.3.0 every key-store call on Android+ hung before it started: the secure-storage plugin was handed to the app as the value of a promise,+ and a Capacitor plugin object answers *any* property name with a native method — `then`+ included — so the promise took it for a thenable, called a native `SecureStorage.then()` that does+ not exist, and never settled. That one stuck `await` was all three reports at once: "Save and use+ the Coach" greyed out forever, the key "not saved" when you came back, and a Coach that sat on+ "thinking…" without end because the job read the key first. The plugin now travels inside a plain+ object, a test drives the store through a Capacitor-style proxy so it cannot come back, and the+ whole flow — save, intake, plan, restart with the key still there — was run on an emulator before+ tagging. The web app and the "use my self-hosted openGym" mode were never affected.+ (issues #42, #58; reported by many on Discord)+## v1.3.4 — 2026-09-05Two things noticed on the phone right after v1.3.3. Web bundle and APK; the API only carries thediff --git a/README.md b/README.mdindex 4fd335ffd..792815bab 100644--- a/README.md+++ b/README.md@@ -210,9 +210,9 @@ host side of that volume, not the variable.## RoadmapThe plan lives in [ROADMAP.md](ROADMAP.md) and on the-[GitLab milestones](https://gitlab.com/DuarteSantos8/opengym/-/milestones): v1.3.4 programmes and+[GitLab milestones](https://gitlab.com/DuarteSantos8/opengym/-/milestones): v1.3.5 programmes andprogression (explicit warm-up/work phases, AMRAP driver selection, multi-week programmes, adaptive-1RM), v1.3.5 accounts and sync (password and OIDC login, personal-trainer role, remote MCP), v1.3.6+1RM), v1.3.6 accounts and sync (password and OIDC login, personal-trainer role, remote MCP), v1.3.7mobile (timer in the notification bar, widgets, Withings). Ideas and merge requests welcome — the[board](https://gitlab.com/DuarteSantos8/opengym/-/boards) shows what is planned, in progress andwaiting for a test on the staging instance.diff --git a/ROADMAP.md b/ROADMAP.mdindex 81edabb12..4e56b93ab 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -57,7 +57,7 @@ Left over from this block:- A real pause for the workout timers (#29 asked for it)- Discord announcement (owner)-## v1.3.4 — Programmes & progression (October 2026)+## v1.3.5 — Programmes & progression (October 2026)**Theme: training structure beyond one weekly template.** Most of this is the Space-Hermes series.It changes the training model (per-set roles, explicit phases, normalisation on every persist), so@@ -81,7 +81,7 @@ it goes in one MR at a time, each rebased and tested on gym-test before the next- Catalogue cleanup: exercises that should not carry weight, incline and interval fields forcardio (#46); timers for planks and outdoor cardio are already there, document them (#45)-## v1.3.5 — Accounts & sync (November 2026)+## v1.3.6 — Accounts & sync (November 2026)**Theme: who may sign in, and what else may read or write your data.**@@ -99,7 +99,7 @@ it goes in one MR at a time, each rebased and tested on gym-test before the nextlogged sessions lost after editing a routine (#25)- Admin: per-user export, invite management, audit log filters-## v1.3.6 — Mobile (December 2026)+## v1.3.7 — Mobile (December 2026)**Theme: the Android app catches up with the web app.**diff --git a/api/openapi.yaml b/api/openapi.yamlindex 0f65de3a9..6b9c29c46 100644--- a/api/openapi.yaml+++ b/api/openapi.yaml@@ -6,7 +6,7 @@ openapi: 3.1.0info:title: openGym API- version: 1.3.4+ version: 1.3.5summary: Passkey (WebAuthn) auth + per-user state storage for openGymdescription: |The backend of [openGym](https://opengym.duarte-santos.ch) — a free, open-sourcediff --git a/api/package-lock.json b/api/package-lock.jsonindex f42f6991f..0075e846f 100644--- a/api/package-lock.json+++ b/api/package-lock.json@@ -1,12 +1,12 @@{"name": "gym-api",- "version": "1.3.4",+ "version": "1.3.5","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "gym-api",- "version": "1.3.4",+ "version": "1.3.5","license": "AGPL-3.0-or-later","dependencies": {"@simplewebauthn/server": "^13.1.1",diff --git a/api/package.json b/api/package.jsonindex 1fda9b00b..c799536a5 100644--- a/api/package.json+++ b/api/package.json@@ -1,6 +1,6 @@{"name": "gym-api",- "version": "1.3.4",+ "version": "1.3.5","private": true,"type": "module","main": "server.js",diff --git a/frontend/android/app/build.gradle b/frontend/android/app/build.gradleindex 8cb0f77ef..e0bae38bd 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.minSdkVersiontargetSdkVersion rootProject.ext.targetSdkVersion- versionCode 18- versionName "1.3.4"+ versionCode 19+ versionName "1.3.5"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.jsonindex 529b7d86a..7b7ff5be8 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -1,12 +1,12 @@{"name": "opengym-frontend",- "version": "1.3.4",+ "version": "1.3.5","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "opengym-frontend",- "version": "1.3.4",+ "version": "1.3.5","license": "AGPL-3.0-or-later","dependencies": {"@aparajita/capacitor-secure-storage": "^7.1.6",diff --git a/frontend/package.json b/frontend/package.jsonindex 4006d1034..daf84a021 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -1,7 +1,7 @@{"name": "opengym-frontend","private": true,- "version": "1.3.4",+ "version": "1.3.5","type": "module","scripts": {"dev": "vite",diff --git a/frontend/src/lib/coach-secrets.js b/frontend/src/lib/coach-secrets.jsindex 4ed7aa91b..3939d1129 100644--- a/frontend/src/lib/coach-secrets.js+++ b/frontend/src/lib/coach-secrets.js@@ -10,12 +10,19 @@const KEY = 'coach.apiKey'const memory = new Map()+// The loaded plugin travels inside a plain object, never as a promise's own value (no `await`+// or `.then` may ever hand the proxy back bare — the wrapper below is the whole point). Capacitor's+// registerPlugin() hands out a Proxy that answers EVERY property name with a native-method+// wrapper — `then` included — so a promise that resolves to the proxy itself takes it for a+// thenable, calls SecureStorage.then() on the native side ("not implemented on android"), and+// never settles. That one await hung the whole feature on the phone: "Save and use the Coach"+// greyed out forever, the key "not saved", the Coach "thinking" without end (issues #42, #58).let pluginPromise = nullfunction plugin() {if (!pluginPromise) {pluginPromise = import('@aparajita/capacitor-secure-storage')- .then(m => (m && m.SecureStorage && typeof m.SecureStorage.get === 'function' ? m.SecureStorage : null))- .catch(() => null)+ .then(m => ({ store: m && m.SecureStorage && typeof m.SecureStorage.get === 'function' ? m.SecureStorage : null }))+ .catch(() => ({ store: null }))}return pluginPromise}@@ -30,7 +37,7 @@ export const withTimeout = (promise, ms = NATIVE_TIMEOUT_MS) => new Promise((res})export async function getApiKey() {- const p = await plugin()+ const { store: p } = await plugin()if (p) {try { const v = await withTimeout(p.get(KEY)); return typeof v === 'string' && v ? v : null } catch { /* fall through */ }}@@ -39,14 +46,14 @@ export async function getApiKey() {export async function setApiKey(value) {const v = String(value || '').trim()if (!v) return clearApiKey()- const p = await plugin()+ const { store: p } = await plugin()if (p) {try { await withTimeout(p.set(KEY, v)); memory.delete(KEY); return } catch { /* fall through */ }}memory.set(KEY, v)}export async function clearApiKey() {- const p = await plugin()+ const { store: p } = await plugin()if (p) { try { await withTimeout(p.remove(KEY)) } catch { /* nothing to clear */ } }memory.delete(KEY)}diff --git a/frontend/src/lib/coach-secrets.test.js b/frontend/src/lib/coach-secrets.test.jsnew file mode 100644index 000000000..34934f781--- /dev/null+++ b/frontend/src/lib/coach-secrets.test.js@@ -0,0 +1,48 @@+// @vitest-environment node+import { describe, it, expect, vi, beforeEach } from 'vitest'++// A stand-in for what @capacitor/core's registerPlugin() really returns: a Proxy that turns ANY+// property — `then` included — into a method wrapper whose native call fails asynchronously+// without ever invoking the callbacks it was handed. Resolving a promise with that object makes+// the promise wait for `then` to call back, which it never does (issues #42 / #58).+const calls = []+const backing = new Map()+const impl = {+ get: async k => (backing.has(k) ? backing.get(k) : null),+ set: async (k, v) => { backing.set(k, v) },+ remove: async k => backing.delete(k)+}+const SecureStorage = new Proxy({}, {+ get(_, prop) {+ if (prop === '$$typeof') return undefined+ if (prop === 'toJSON') return () => ({})+ return (...args) => {+ calls.push(String(prop))+ if (impl[prop]) return impl[prop](...args)+ return Promise.reject(new Error(`"SecureStorage.${String(prop)}()" is not implemented on android`))+ }+ }+})+vi.mock('@aparajita/capacitor-secure-storage', () => ({ SecureStorage }))++const secrets = await import('./coach-secrets.js')++const within = (p, ms) => Promise.race([p, new Promise((_, rej) => setTimeout(() => rej(new Error(`hung for ${ms} ms`)), ms))])++describe('coach-secrets against a Capacitor-style plugin proxy', () => {+ beforeEach(() => { calls.length = 0; backing.clear() })++ it('a round trip settles instead of waiting on the proxy\'s never-answering then()', async () => {+ await within(secrets.setApiKey('sk-live-1'), 1000)+ expect(await within(secrets.getApiKey(), 1000)).toBe('sk-live-1')+ await within(secrets.clearApiKey(), 1000)+ expect(await within(secrets.getApiKey(), 1000)).toBe(null)+ expect(calls).not.toContain('then')+ })++ it('goes through the platform store, not the in-memory fallback', async () => {+ await within(secrets.setApiKey('sk-live-2'), 1000)+ expect([...backing.keys()]).toEqual(['coach.apiKey'])+ expect(calls).toEqual(['set'])+ })+})diff --git a/website/api.html b/website/api.htmlindex 528e6bc5a..34c19b5d6 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.4).+ Built by scripts/build-api-docs.mjs from api/openapi.yaml (openGym API v1.3.5).Regenerate with: node scripts/build-api-docs.mjs --><html lang="en"><head>@@ -232,7 +232,7 @@ 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.4</span>+ <span>openGym v1.3.5</span><span>28 endpoints</span><span>AGPL-3.0-or-later</span></p>diff --git a/website/index.html b/website/index.htmlindex 8ddaaf237..1a6d78df2 100644--- a/website/index.html+++ b/website/index.html@@ -404,7 +404,7 @@ try {</ul><div class="push"><a class="btn" href="openGym.apk" download>Download for Android</a>- <p class="meta">v1.3.4 · 27.7 MB · Android 6.0+ · signed APK. Your browser will ask+ <p class="meta">v1.3.5 · 27.7 MB · Android 6.0+ · signed APK. Your browser will askbefore 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://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab