Compare commits

..
8 Commits
Author SHA1 Message Date
Duarte Santos d6f0db9b4b v1.3.1 2026-09-04 09:51:25 +02:00
Duarte Santos 565311accc Handy: 'Use my self-hosted openGym' erkennt den Coach des gepaarten Servers
Der Mobile-Boot und das Pairing haben /api/config nie geladen, nur die Web-Variante und der
Login-Screen. Auf dem gepaarten Handy stand deshalb im Coach-Setup immer 'Your server has no
Coach enabled' — waehrend der Admin auf einen gruenen Test schaute (Discord-Meldung, 2026-09-04).
Jetzt: refreshConfig() fragt immer, loadConfig() cached nur noch darueber; Boot (remote) und
connectToServer laden die Config, der Setup-Screen fragt beim Oeffnen neu und zeigt bis dahin
'Loading…'. Regressionstest fuer load/refresh.
2026-09-04 09:51:01 +02:00
Duarte Santos 8b7abe5c26 Website: der AI Coach steht auf der Startseite 2026-09-03 23:24:30 +02:00
Duarte Santos 6b3c7d0ed7 v1.3.0 2026-09-03 23:08:45 +02:00
Duarte Santos eead4afd88 assets: Brand-Dateien wieder raus, die 11d5632 versehentlich mitgenommen hat
BMC-Cover, Logo-Varianten und Merch-Vorlagen lagen unversioniert im Arbeitsverzeichnis und
sind mit einem git add -A in den Stats-Commit gerutscht. Sie gehoeren nicht ins oeffentliche
Repo; ab hier sind sie wieder unversioniert (in der Historie bleiben sie, main ist gegen
Force-Push geschuetzt).
2026-09-03 23:05:05 +02:00
Duarte Santos 11d5632156 Stats: die Strength-Liste sagt, wie lange ein Muskel nicht trainiert wurde
Die Zeilen unter der Strength-Karte zeigten die Saetze der letzten 90 Tage — fuer Muskeln,
die genau deshalb in der Liste stehen, weil sie lange nicht trainiert wurden, also fast immer
0, und sonst als ungerundeter Float (1.2000000000000002). Jetzt: Wochen seit dem letzten
Training bzw. 'not trained', gerundete 90-Tage-Saetze nur darueber, wenn es welche gibt.
Balance-Zeilen runden ueber fmtNum.
2026-09-03 23:01:34 +02:00
Duarte Santos 12309f394b Website: APK-Zeile v1.2.16 · 4.8 MB 2026-09-03 22:55:28 +02:00
Duarte Santos f190f0ba4a v1.2.16: das Web-Image baut wieder, und ein MR-Check dafuer
web/Dockerfile kopierte nur frontend/, aber frontend/src importiert den Coach-Kern aus
api/coach/core (../../../api/coach/core/*). Der Build-Stage liegt jetzt unter /app/frontend
und bekommt api/coach/core an derselben relativen Stelle wie im Repo. Neuer Job
build:web-check baut das Web-Image in jeder MR-Pipeline, die frontend/, web/ oder den Kern
anfasst (der API-Check gab es schon, den Web-Check nicht — deshalb ist v1.2.15 durchgerutscht).
Auf der VM gebaut und geprueft: App-Shell 200, Coach im Bundle.
2026-09-03 22:45:31 +02:00
14 changed files with 177 additions and 19 deletions

No files matched your search

+41
View File
@@ -318,6 +318,47 @@ build:api-check:
when: manual
allow_failure: true
# The web image is built from the repository root, and the frontend imports the Coach core from
# api/coach/core — a path the Dockerfile has to copy by hand. Nothing in test:frontend or the
# Pages build goes through that Dockerfile, so an MR could pass everything and still ship an
# image that does not build (v1.2.15 did). Built here, never pushed.
build:web-check:
stage: build
image: docker:28-cli
services:
- docker:28-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: "/certs/client"
needs: ["test:frontend"]
script:
- docker build -f web/Dockerfile -t opengym-web:check .
# It serves the app shell, and the shell is this build (the Coach setup is in the bundle).
- |
set -eu
docker run -d --name web-check -e BACKEND=127.0.0.1 -e PORT=3000 opengym-web:check
sleep 2
docker exec web-check wget -qO- http://127.0.0.1/ | grep -q '<div id="root">'
docker exec web-check sh -c 'grep -l "coach" /usr/share/nginx/html/assets/index-*.js >/dev/null'
docker rm -f web-check
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
paths:
- "frontend/**/*"
- "web/**/*"
- "api/coach/core/**/*"
- ".gitlab-ci.yml"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
# ------------------------------------------------------------------------------ apk
# The official signed APK. Signing keys live in protected CI variables, so they only
+32
View File
@@ -1,5 +1,37 @@
# Changelog
## v1.3.1 — 2026-09-04
- 📱 **"Use my self-hosted openGym" works on a paired phone.** The phone app never fetched the
server's `/api/config` after boot or after pairing, so the Coach setup screen told everyone
"your server has no Coach enabled" — while the admin was looking at a passed test. The screen
now asks the server afresh every time it opens, and the boot and pairing paths load the config
like the web app always did. Reported on Discord.
## v1.3.0 — 2026-09-03
The AI Coach gets the version number it deserves. v1.2.16, earlier today, was the release that
got it out of the door; v1.3.0 is the same app with one more fix, and the number that says
"something new is in here" to everyone who reads a changelog. If you are on v1.2.16, this is
a small update. If you are on anything older, read the v1.2.15/v1.2.16 notes below — the Coach,
bar weights, the rest-day line and the rewritten admin dashboard are all new to you.
- 🗺️ **The Strength map's list makes sense again.** Below the map, every detrained muscle
showed its set count of the last 90 days — which, for a muscle that is on that list precisely
because it has not been trained lately, was a column of "0 sets", and where it was not zero it
printed as `1.2000000000000002`. Each row now says how many weeks ago the muscle was last
trained (or "not trained"), with the rounded 90-day sets on top only when there are any.
## v1.2.16 — 2026-09-03
- 🐳 **The web image builds again.** v1.2.15's tag pipeline published the API image and the APK
but the web image failed to build: the frontend imports the Coach's core from `api/coach/core`,
and `web/Dockerfile` copied only `frontend/`. The image now carries that directory at the same
relative position it has in the repository, and a new `build:web-check` job builds the web
image on every merge request that touches the frontend, the Dockerfile or the core — the API
image had that check, the web image did not. Nothing else changed; v1.2.15's notes below are
this release's notes.
## v1.2.15 — 2026-09-03
The AI Coach. An optional coach that designs a training plan from a few answers and reviews
+1 -1
View File
@@ -6,7 +6,7 @@ openapi: 3.1.0
info:
title: openGym API
version: 1.2.15
version: 1.3.1
summary: Passkey (WebAuthn) auth + per-user state storage for openGym
description: |
The backend of [openGym](https://opengym.duarte-santos.ch) — a free, open-source
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gym-api",
"version": "1.2.15",
"version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gym-api",
"version": "1.2.15",
"version": "1.3.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@simplewebauthn/server": "^13.1.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gym-api",
"version": "1.2.15",
"version": "1.3.1",
"private": true,
"type": "module",
"main": "server.js",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "opengym-frontend",
"version": "1.2.15",
"version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opengym-frontend",
"version": "1.2.15",
"version": "1.3.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@aparajita/capacitor-secure-storage": "^7.1.6",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "opengym-frontend",
"private": true,
"version": "1.2.15",
"version": "1.3.1",
"type": "module",
"scripts": {
"dev": "vite",
@@ -0,0 +1,43 @@
// @vitest-environment happy-dom
// /api/config is what tells a client whether the server offers the Coach (and guest mode).
// loadConfig() caches it for a boot; refreshConfig() always asks — the Coach setup screen on a
// paired phone relies on that, because the admin may have switched the Coach on since boot.
// The bug this pins: the phone never fetched it at all, and said "your server has no Coach
// enabled" to a server whose admin was looking at a green test.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
vi.mock('../lib/api.js', () => ({ api: vi.fn() }))
import { api } from '../lib/api.js'
import { useStore } from './useStore.js'
beforeEach(() => { api.mockReset(); useStore.setState({ config: null }) })
afterEach(() => { useStore.setState({ config: null }) })
describe('server config', () => {
it('loadConfig fetches once and then answers from the cache', async () => {
api.mockResolvedValue({ invite_only: true, allow_guest: false, coach: { enabled: true } })
expect(await useStore.getState().loadConfig()).toEqual({ invite_only: true, allow_guest: false, coach: { enabled: true } })
expect(await useStore.getState().loadConfig()).toMatchObject({ coach: { enabled: true } })
expect(api).toHaveBeenCalledTimes(1)
expect(api).toHaveBeenCalledWith('/api/config')
})
it('refreshConfig always asks the server, so a Coach switched on after boot is seen', async () => {
api.mockResolvedValueOnce({ invite_only: true, allow_guest: false })
await useStore.getState().loadConfig()
expect(useStore.getState().config.coach).toBeUndefined()
api.mockResolvedValueOnce({ invite_only: true, allow_guest: false, coach: { enabled: true, provider: 'anthropic' } })
await useStore.getState().refreshConfig()
expect(useStore.getState().config.coach.enabled).toBe(true)
expect(api).toHaveBeenCalledTimes(2)
})
it('an unreachable server leaves the cached config alone', async () => {
useStore.setState({ config: { coach: { enabled: true } } })
api.mockRejectedValueOnce(new Error('offline'))
expect(await useStore.getState().refreshConfig()).toBeNull()
expect(useStore.getState().config.coach.enabled).toBe(true)
})
})
+10
View File
@@ -152,6 +152,11 @@ export const useStore = create((set, get) => {
config: null,
async loadConfig() {
if (get().config) return get().config
return get().refreshConfig()
},
// Always asks. The cached copy is right for one boot, but an admin can switch the Coach on
// while a paired phone sits on the setup screen — that screen wants today's answer.
async refreshConfig() {
try { const c = await api('/api/config'); set({ config: c }); return c }
catch { return null }
},
@@ -197,6 +202,7 @@ export const useStore = create((set, get) => {
async connectToServer(url, code) {
const user = await connect(url, code) // throws on a bad URL/expired code — caller shows it
get().setUser(user)
await get().refreshConfig() // what this server offers (the Coach, guest mode) — see boot()
await get().pullState()
syncReminder(get().S)
set({ needsMobileOnboarding: false })
@@ -243,6 +249,10 @@ export const useStore = create((set, get) => {
try {
const me = await api('/api/me') // also catches a token revoked elsewhere (sign out everywhere)
get().setUser(me.user)
// The paired server's /api/config, the same one the web boot reads: without it the
// phone never learned whether the server offers the Coach and told everyone "your
// server has no Coach enabled" — with the admin looking at a green test.
await get().loadConfig()
await get().pullState()
} catch (e) {
if (e.status === 401) { await forgetRemote(); get().setGuest(true) }
+4 -1
View File
@@ -31,6 +31,7 @@ export default function CoachSetup() {
const config = useStore(s => s.config)
const coachLocal = useStore(s => s.coachLocal)
const setCoachLocal = useStore(s => s.setCoachLocal)
const refreshConfig = useStore(s => s.refreshConfig)
const toast = useUI(s => s.toast)
const openSheet = useUI(s => s.openSheet)
@@ -46,6 +47,8 @@ export default function CoachSetup() {
useEffect(() => { if (!MOBILE) nav('/settings', { replace: true }) }, [])
useEffect(() => { getApiKey().then(k => setHasKey(!!k)) }, [])
// Ask the paired server afresh: the admin may have switched the Coach on since this phone booted.
useEffect(() => { if (user) refreshConfig() }, [user])
useEffect(() => { setModels(null); setModel(coachLocal?.provider === provider ? (coachLocal?.model || '') : '') }, [provider])
const meta = HTTP_PROVIDERS[provider] || {}
@@ -112,7 +115,7 @@ export default function CoachSetup() {
<Section title={t('How should the Coach run?')} footer={current}>
<Row icon="rocket" iconTint="var(--indigo)" title={t('Use my self-hosted openGym')}
subtitle={user ? (serverHasCoach ? t('Your server runs the Coach with whatever provider its admin set up. Nothing new leaves this phone beyond what already syncs.') : t('Your server has no Coach enabled — ask its admin, or bring your own key below.')) : t('Connect to my server')}
subtitle={user ? (serverHasCoach ? t('Your server runs the Coach with whatever provider its admin set up. Nothing new leaves this phone beyond what already syncs.') : config == null ? t('Loading…') : t('Your server has no Coach enabled — ask its admin, or bring your own key below.')) : t('Connect to my server')}
accessory="chevron" onClick={() => { if (!user || serverHasCoach) useServer(); else setChoice('server') }} />
<Row icon="key" iconTint="var(--acc)" title={t('Bring my own API key')}
subtitle={t('This phone calls the provider directly with your key. Every request is charged to your account.')}
+16 -6
View File
@@ -138,7 +138,7 @@ function MuscleBalance({ S }) {
const detrained = strengthOrder.filter(slug => strength[slug] < 1)
const top = worked.slice(0, 4)
const max = worked.length ? load[worked[0]] : 0
const sets = m => Math.round((load[m] || 0) * 10) / 10
const sets = m => fmtNum(Math.round((load[m] || 0) * 10) / 10)
return <div className="card">
<Segmented className="seg-range" value={view} onChange={setView}
@@ -206,11 +206,21 @@ function MuscleBalance({ S }) {
)) : <div className="muted small">{t('No exercises with an estimated 1RM yet.')}</div>}
</>}
{!sel && <div className="muted small" style={{ marginTop: 10 }}>{t('Tap a muscle to see its exercises.')}</div>}
{detrained.map(slug => <div key={slug} className="mrow">
<span className="nm">{t(MUSCLE_NAME[slug])}</span>
<span className="bar"><i style={{ width: Math.round(strength[slug] * 100) + '%' }} /></span>
<span className="v">{t('{0} sets', vol90[slug] || 0)}</span>
</div>)}
{/* Detrained muscles: the bar is retained strength, the value says how long ago the
muscle was last trained. Sets in the last 90 days ride along only when there are
any — a muscle is on this list precisely because it has not been trained lately, so
that number alone read as "0 sets" all the way down and told nobody anything. */}
{detrained.map(slug => {
const sets90 = Math.round((vol90[slug] || 0) * 10) / 10
return <div key={slug} className="mrow">
<span className="nm">{t(MUSCLE_NAME[slug])}</span>
<span className="bar"><i style={{ width: Math.round(strength[slug] * 100) + '%' }} /></span>
<span className="v" style={{ textAlign: 'right' }}>
{sets90 ? t('{0} sets', fmtNum(sets90)) : strengthHint(slug)}
{sets90 ? <span className="dim small" style={{ display: 'block', fontWeight: 400 }}>{strengthHint(slug)}</span> : null}
</span>
</div>
})}
</>}
</div>
}
+7 -2
View File
@@ -8,9 +8,14 @@
# specific native binaries, which is what breaks `vite build` with unrelated-looking
# module-resolution errors.
FROM --platform=$BUILDPLATFORM node:22-alpine AS build
WORKDIR /app
# The frontend sits at /app/frontend, not /app: the Coach's runtime-neutral core lives in
# api/coach/core and is imported from frontend/src as ../../../api/coach/core/*, so the two
# have to keep the same relative position they have in the repository. Copying frontend/ alone
# is exactly what made the v1.2.15 web image fail to build.
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci 2>/dev/null || npm install
COPY api/coach/core/ /app/api/coach/core/
COPY frontend/ ./
RUN npm run build
@@ -31,7 +36,7 @@ LABEL maintainer="Duarte Santos https://gitlab.com/DuarteSantos8" \
org.opencontainers.image.created=$BUILD_DATE
COPY web/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/frontend/dist /usr/share/nginx/html
# exercise media (img/gif) is mounted at runtime from the media volume
# Set Default ENVs for nginx
+2 -2
View File
@@ -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.2.15).
Built by scripts/build-api-docs.mjs from api/openapi.yaml (openGym API v1.3.1).
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.2.15</span>
<span>openGym v1.3.1</span>
<span>28 endpoints</span>
<span>AGPL-3.0-or-later</span>
</p>
+15 -1
View File
@@ -188,6 +188,20 @@ try {
one tells you where it came from.</p>
</div>
<div class="tile full rv">
<div class="ic"><svg><use href="#i-sparkle"/></svg></div>
<h3>An AI coach, if you want one</h3>
<p>Optional, off by default, and it runs on whatever AI you bring — an Anthropic, OpenAI
or Gemini key, any OpenAI-compatible endpoint such as Ollama on your own network, or a
Claude Code / Codex runtime in the container. Nothing it proposes is applied on its
own; every change carries its reason and can be undone.</p>
<div class="trio">
<div><b>Plan</b>A week of routines from a few questions: goal, days, session length, equipment, limits.</div>
<div><b>Review</b>Reads what you actually logged — stalls, effort, body weight — and proposes changes with the evidence.</div>
<div><b>Private</b>An allowlist under an opaque handle leaves your server. Keys stay encrypted; admins see counts, never questions.</div>
</div>
</div>
<div class="tile full rv">
<div class="ic"><svg><use href="#i-body"/></svg></div>
<h3>A muscle map that reads three ways</h3>
@@ -390,7 +404,7 @@ try {
</ul>
<div class="push">
<a class="btn" href="openGym.apk" download>Download for Android</a>
<p class="meta">v1.2.15 · 4.6 MB · Android 6.0+ · signed APK. Your browser will ask
<p class="meta">v1.3.1 · 4.8 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://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab