Settings: an Updates section as the last thing on the page (check and install on Android, APK link on the web); changelog for the merged MRs
The deload-demo.html page from !103 does not ship: frontend/public/ lands in every dist.
This commit is contained in:
1 parent
637e32a904
commit
bf9764e3a2
18 files changed
+220
-128
No files matched your search
@@ -20,6 +20,29 @@ see why. Web bundle and APK; the API image only for the payload change.
|
||||
thing as before" had nothing to point at: every message was a fresh request. The last six lines
|
||||
— what you wrote and what the Coach concluded, never proposals or errors — now travel with the
|
||||
request as context (`conversation`, documented in the prompt as data, not instruction).
|
||||
- ⬇️ **Updates are the last thing in Settings.** On Android a permanent row checks gitlab.com on
|
||||
demand and installs a newer release with one tap (the download is verified against its checksum
|
||||
first); on the web the same spot links to the APK. The row no longer hides inside "Data" and no
|
||||
longer disappears when there is nothing new.
|
||||
- 🧩 **Combine routines** (HenryByte, !102, #59): a weekday can hold several routines, and a running
|
||||
session can pull another routine in from the header ⋮ — a rehab routine on top of push day. The
|
||||
layout switch moved into that menu. Older data with one routine per day reads unchanged.
|
||||
- 📐 **Compact layout** (HenryByte, !100, #57): a third workout view with only the sets you are
|
||||
logging, and a per-session ⋮ switcher between cards, list and compact.
|
||||
- 🦵 **One-sided exercises log each side** (ErrorUsernameAlreadyTaken, !107, #60): weight, reps,
|
||||
effort and the done tick per side, drop-sets and rest-pause per side too; history reads
|
||||
"L 15×8 · R 15×7". Totals, volume, PRs and progression keep reading the combined row.
|
||||
- ✅ **Rating a set completes it** (ErrorUsernameAlreadyTaken, !106, #64): picking RIR/RPE ticks the
|
||||
set and starts the rest timer.
|
||||
- 🎫 **Check-in cards** (ErrorUsernameAlreadyTaken, !105): edit a card's photo and label, the last
|
||||
card used opens first, manual code entry removed.
|
||||
- 📉 **Deloads aim at an estimated 1RM** (mflova, !103): linear and double progression deload to
|
||||
90 % of the Epley estimate of the target, on the exercise's weight grid, never above the load
|
||||
that stalled — a 5 kg lift keeps 5 kg and drops reps instead of falling to 2.5 kg. The factor is
|
||||
per exercise.
|
||||
- 📈 **A climb through the rep range is progress, not a stall** (arhx91, !101): under double
|
||||
progression a session that beat its best at the current weight no longer counts toward a deload.
|
||||
- 👈 **Swipe to remove** (surohsusej, !73): swipe a routine exercise or warm-up set left to remove it.
|
||||
- 🧹 **The OpenAI model list only shows models this request shape can use.** The account's full
|
||||
list — speech, embeddings, image models, realtime and Responses-only variants — made it easy to
|
||||
pick one Chat Completions refuses with a 400 or a 404. Compatible endpoints (Ollama, LM Studio,
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>openGym Epley deload demo</title>
|
||||
<style>
|
||||
:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #10151b; color: #edf2f7; }
|
||||
body { max-width: 860px; margin: 0 auto; padding: 28px 18px 48px; }
|
||||
h1 { margin: 0 0 8px; font-size: 1.55rem; }
|
||||
.muted { color: #9aa8b5; line-height: 1.5; }
|
||||
.panel { background: #18212b; border: 1px solid #2c3b49; border-radius: 14px; padding: 18px; margin-top: 16px; }
|
||||
label { display: block; color: #b8c6d3; font-size: .86rem; margin-bottom: 6px; }
|
||||
select, button { font: inherit; border-radius: 9px; border: 1px solid #405464; padding: 10px 12px; background: #111a22; color: inherit; }
|
||||
button { cursor: pointer; background: #2c8c70; border-color: #42b992; font-weight: 650; }
|
||||
button:hover { background: #35a17f; }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
|
||||
.card { background: #111a22; border-radius: 10px; padding: 13px; }
|
||||
.k { color: #90a3b4; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
|
||||
.v { font-size: 1.15rem; font-weight: 700; margin-top: 4px; }
|
||||
.ok { color: #63dbad; }
|
||||
.warn { color: #ffd27a; }
|
||||
code { color: #a9d8ff; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Epley-based automatic deload</h1>
|
||||
<p class="muted">Synthetic review fixture. Select a predefined case, then trigger the deload. The
|
||||
target 1RM uses the prescribed weight and reps; a partial failure does not substitute the lower
|
||||
actual reps. Output load is always bounded by the attempted current load.</p>
|
||||
<div class="panel">
|
||||
<label for="preset">Preset scenario</label>
|
||||
<select id="preset">
|
||||
<option value="linear">Linear · 60 kg × 8</option>
|
||||
<option value="double">Double · 40 kg × 12 · range 8–12</option>
|
||||
<option value="side">Per-side · 60 kg × 8 total</option>
|
||||
<option value="small">Below-step · 1 kg × 5 · step 2.5</option>
|
||||
<option value="partial">Partial failure · target 60 × 8, actual 60 × 6</option>
|
||||
</select>
|
||||
<button id="trigger" type="button">Trigger deload</button>
|
||||
<div id="result" class="grid" aria-live="polite"></div>
|
||||
</div>
|
||||
<div class="panel muted">
|
||||
<strong>What to check</strong>
|
||||
<ul>
|
||||
<li>Linear keeps the prescribed reps and moves to the nearest valid load grid.</li>
|
||||
<li>Double progression can keep the current load with fewer reps when that is the closest valid Epley solution.</li>
|
||||
<li>Per-side estimates use reps per side and return an even total.</li>
|
||||
<li>The below-step case holds 1 kg rather than incorrectly increasing it to 2.5 kg.</li>
|
||||
</ul>
|
||||
<div>Formula: <code>1RM = weight × (1 + reps / 30)</code>; deload target = estimated 1RM × <code>0.9</code>.</div>
|
||||
</div>
|
||||
<script>
|
||||
const PRESETS = {
|
||||
linear: { label: 'Linear', weight: 60, reps: 8, step: 2.5 },
|
||||
double: { label: 'Double 8–12', weight: 40, reps: 12, repsMin: 8, step: 2.5 },
|
||||
side: { label: 'Per-side', weight: 60, reps: 8, step: 2.5, side: true },
|
||||
small: { label: 'Below-step', weight: 1, reps: 5, step: 2.5 },
|
||||
partial: { label: 'Partial failure', weight: 60, reps: 8, actual: 6, step: 2.5 }
|
||||
}
|
||||
const round = n => Math.round(n * 10) / 10
|
||||
const snap = (n, step) => Math.round(n / step) * step
|
||||
const epley = (weight, reps, side) => weight * (1 + (side ? reps / 2 : reps) / 30)
|
||||
function choose(p) {
|
||||
const target = round(epley(p.weight, p.reps, p.side) * .9)
|
||||
const min = p.repsMin || p.reps
|
||||
const stride = p.side ? 2 : 1
|
||||
const reps = []
|
||||
for (let r = p.reps; r >= min; r -= stride) reps.push(r)
|
||||
const candidates = []
|
||||
for (const r of reps) {
|
||||
const ideal = target / (1 + (p.side ? r / 2 : r) / 30)
|
||||
for (const w of new Set([snap(ideal, p.step), Math.floor(ideal / p.step) * p.step])) {
|
||||
if (w > 0 && w <= p.weight) candidates.push({ w, r })
|
||||
}
|
||||
if (r < p.reps) candidates.push({ w: p.weight, r })
|
||||
}
|
||||
if (!candidates.length) candidates.push({ w: p.weight, r: p.reps })
|
||||
candidates.sort((a, b) => Math.abs(epley(a.w, a.r, p.side) - target) - Math.abs(epley(b.w, b.r, p.side) - target) || Math.abs(a.r - p.reps) - Math.abs(b.r - p.reps))
|
||||
const best = candidates[0]
|
||||
return { target, weight: best.w, reps: best.r, actual: p.actual || p.reps }
|
||||
}
|
||||
function oldDeload(p) { return Math.max(p.step, snap(p.weight * .9, p.step)) }
|
||||
function card(k, v, cls = '') { return `<div class="card"><div class="k">${k}</div><div class="v ${cls}">${v}</div></div>` }
|
||||
function render(triggered = false) {
|
||||
const p = PRESETS[document.querySelector('#preset').value]
|
||||
const r = triggered ? choose(p) : null
|
||||
const target = round(epley(p.weight, p.reps, p.side) * .9)
|
||||
const shown = r || { weight: '—', reps: '—', actual: p.actual || p.reps }
|
||||
const safe = !r || r.weight <= p.weight
|
||||
document.querySelector('#result').innerHTML = [
|
||||
card('Scenario', p.label), card('Current target', `${p.weight} kg × ${p.reps}`),
|
||||
card('Actual logged reps', `${p.actual || p.reps} (target reps remain ${p.reps})`),
|
||||
card('Old deload', `${oldDeload(p)} kg × ${p.reps}`), card('Epley deload 1RM', `${target} kg`),
|
||||
card('New selected target', triggered ? `${shown.weight} kg × ${shown.reps}` : 'Press Trigger deload'),
|
||||
card('Safety bound', safe ? 'weight ≤ current ✓' : 'INVALID: increased load', safe ? 'ok' : 'warn')
|
||||
].join('')
|
||||
}
|
||||
document.querySelector('#trigger').addEventListener('click', () => render(true))
|
||||
document.querySelector('#preset').addEventListener('change', () => render(false))
|
||||
render(false)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(631)
|
||||
expect(inherited).toHaveLength(624)
|
||||
expect(inherited).toHaveLength(634)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('648111fcbd54b6d76410830ad2494cbdc03e2edcfb787e377217183183754e15')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('a5c4326e9e6de3b0f66bcfc86a0bfb15e2ca5f178bc8366e79e97ab7e1dd7853')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -1211,7 +1211,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'Die neueste Version wird heruntergeladen und die Installation gestartet.',
|
||||
'Download & Install': 'Herunterladen & Installieren',
|
||||
'Update failed: {0}': 'Update fehlgeschlagen: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} verfügbar',
|
||||
'Updates': 'Updates',
|
||||
'Check for updates': 'Nach Updates suchen',
|
||||
'Checking…': 'Wird geprüft…',
|
||||
'You have v{0}': 'Du hast v{0}',
|
||||
'Update to openGym v{0}': 'Auf openGym v{0} aktualisieren',
|
||||
'You have the latest version.': 'Du hast die neueste Version.',
|
||||
'Could not check for updates — are you online?': 'Update-Prüfung fehlgeschlagen — bist du online?',
|
||||
'Get the Android app': 'Android-App holen',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'APK von opengym.duarte-santos.ch laden',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Releases werden auf gitlab.com geprüft. Der Download wird vor dem Öffnen des Installers gegen seine Prüfsumme verifiziert.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'Die Web-App aktualisiert sich mit deinem Server. Die Android-App installiert ihre Updates von hier aus.',
|
||||
'Starting download…': 'Download wird gestartet…',
|
||||
'Downloading update…': 'Update wird heruntergeladen…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'Se descargará la última versión y se abrirá el instalador.',
|
||||
'Download & Install': 'Descargar e instalar',
|
||||
'Update failed: {0}': 'Error en la actualización: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} disponible',
|
||||
'Updates': 'Actualizaciones',
|
||||
'Check for updates': 'Buscar actualizaciones',
|
||||
'Checking…': 'Comprobando…',
|
||||
'You have v{0}': 'Tienes la v{0}',
|
||||
'Update to openGym v{0}': 'Actualizar a openGym v{0}',
|
||||
'You have the latest version.': 'Tienes la última versión.',
|
||||
'Could not check for updates — are you online?': 'No se pudo comprobar — ¿estás conectado?',
|
||||
'Get the Android app': 'Descargar la app de Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Descarga el APK desde opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Las versiones se comprueban en gitlab.com. La descarga se verifica con su suma de comprobación antes de abrir el instalador.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'La app web se actualiza junto con tu servidor. La app de Android instala sus actualizaciones desde aquí.',
|
||||
'Starting download…': 'Iniciando descarga…',
|
||||
'Downloading update…': 'Descargando actualización…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'La dernière version sera téléchargée et l’installateur s’ouvrira.',
|
||||
'Download & Install': 'Télécharger et installer',
|
||||
'Update failed: {0}': 'Échec de la mise à jour : {0}',
|
||||
'openGym v{0} available': 'openGym v{0} disponible',
|
||||
'Updates': 'Mises à jour',
|
||||
'Check for updates': 'Rechercher des mises à jour',
|
||||
'Checking…': 'Vérification…',
|
||||
'You have v{0}': 'Tu as la v{0}',
|
||||
'Update to openGym v{0}': 'Mettre à jour vers openGym v{0}',
|
||||
'You have the latest version.': 'Tu as la dernière version.',
|
||||
'Could not check for updates — are you online?': 'Impossible de vérifier — es-tu en ligne ?',
|
||||
'Get the Android app': 'Télécharger l’app Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Télécharge l’APK depuis opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Les versions sont vérifiées sur gitlab.com. Le téléchargement est contrôlé avec sa somme de contrôle avant l’ouverture de l’installateur.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'L’app web se met à jour avec ton serveur. L’app Android installe ses mises à jour depuis ici.',
|
||||
'Starting download…': 'Démarrage du téléchargement…',
|
||||
'Downloading update…': 'Téléchargement de la mise à jour…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'नवीनतम संस्करण डाउनलोड होगा और इंस्टॉलर खुलेगा।',
|
||||
'Download & Install': 'डाउनलोड और इंस्टॉल करें',
|
||||
'Update failed: {0}': 'अपडेट विफल: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} उपलब्ध',
|
||||
'Updates': 'अपडेट',
|
||||
'Check for updates': 'अपडेट देखें',
|
||||
'Checking…': 'जाँच हो रही है…',
|
||||
'You have v{0}': 'आपके पास v{0} है',
|
||||
'Update to openGym v{0}': 'openGym v{0} पर अपडेट करें',
|
||||
'You have the latest version.': 'आपके पास नवीनतम संस्करण है।',
|
||||
'Could not check for updates — are you online?': 'अपडेट जाँच नहीं हो सकी — क्या आप ऑनलाइन हैं?',
|
||||
'Get the Android app': 'Android ऐप लें',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'opengym.duarte-santos.ch से APK डाउनलोड करें',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'रिलीज़ gitlab.com पर जाँची जाती हैं। इंस्टॉलर खुलने से पहले डाउनलोड की चेकसम से पुष्टि होती है।',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'वेब ऐप आपके सर्वर के साथ अपडेट होता है। Android ऐप अपने अपडेट यहीं से इंस्टॉल करता है।',
|
||||
'Starting download…': 'डाउनलोड शुरू हो रहा है…',
|
||||
'Downloading update…': 'अपडेट डाउनलोड हो रहा है…',
|
||||
'{0} %': '{0}%',
|
||||
|
||||
@@ -1194,7 +1194,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'A legújabb verzió letöltődik, és megnyílik a telepítő.',
|
||||
'Download & Install': 'Letöltés és telepítés',
|
||||
'Update failed: {0}': 'A frissítés sikertelen: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} elérhető',
|
||||
'Updates': 'Frissítések',
|
||||
'Check for updates': 'Frissítések keresése',
|
||||
'Checking…': 'Ellenőrzés…',
|
||||
'You have v{0}': 'Nálad a v{0} van',
|
||||
'Update to openGym v{0}': 'Frissítés az openGym v{0} verzióra',
|
||||
'You have the latest version.': 'A legújabb verziód van.',
|
||||
'Could not check for updates — are you online?': 'Nem sikerült ellenőrizni — online vagy?',
|
||||
'Get the Android app': 'Android-alkalmazás letöltése',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Töltsd le az APK-t az opengym.duarte-santos.ch oldalról',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'A kiadásokat a gitlab.com-on ellenőrizzük. A letöltést a telepítő megnyitása előtt az ellenőrzőösszeggel vetjük össze.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'A webalkalmazás a szerverrel együtt frissül. Az Android-alkalmazás innen telepíti a frissítéseit.',
|
||||
'Starting download…': 'Letöltés indítása…',
|
||||
'Downloading update…': 'Frissítés letöltése…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'L’ultima versione verrà scaricata e si aprirà il programma di installazione.',
|
||||
'Download & Install': 'Scarica e installa',
|
||||
'Update failed: {0}': 'Aggiornamento fallito: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} disponibile',
|
||||
'Updates': 'Aggiornamenti',
|
||||
'Check for updates': 'Cerca aggiornamenti',
|
||||
'Checking…': 'Controllo…',
|
||||
'You have v{0}': 'Hai la v{0}',
|
||||
'Update to openGym v{0}': 'Aggiorna a openGym v{0}',
|
||||
'You have the latest version.': 'Hai l’ultima versione.',
|
||||
'Could not check for updates — are you online?': 'Impossibile controllare — sei online?',
|
||||
'Get the Android app': 'Scarica l’app Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Scarica l’APK da opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Le release vengono controllate su gitlab.com. Il download è verificato con il suo checksum prima di aprire l’installer.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'L’app web si aggiorna insieme al tuo server. L’app Android installa i suoi aggiornamenti da qui.',
|
||||
'Starting download…': 'Avvio del download…',
|
||||
'Downloading update…': 'Download dell’aggiornamento…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': '최신 버전이 다운로드되고 설치 프로그램이 열립니다.',
|
||||
'Download & Install': '다운로드 및 설치',
|
||||
'Update failed: {0}': '업데이트 실패: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} 사용 가능',
|
||||
'Updates': '업데이트',
|
||||
'Check for updates': '업데이트 확인',
|
||||
'Checking…': '확인 중…',
|
||||
'You have v{0}': '현재 v{0}',
|
||||
'Update to openGym v{0}': 'openGym v{0}(으)로 업데이트',
|
||||
'You have the latest version.': '최신 버전입니다.',
|
||||
'Could not check for updates — are you online?': '업데이트를 확인할 수 없어요 — 온라인 상태인가요?',
|
||||
'Get the Android app': 'Android 앱 받기',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'opengym.duarte-santos.ch에서 APK 다운로드',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': '릴리스는 gitlab.com에서 확인합니다. 설치 프로그램이 열리기 전에 다운로드의 체크섬을 검증합니다.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': '웹 앱은 서버와 함께 업데이트됩니다. Android 앱은 여기서 직접 업데이트를 설치합니다.',
|
||||
'Starting download…': '다운로드 시작 중…',
|
||||
'Downloading update…': '업데이트 다운로드 중…',
|
||||
'{0} %': '{0}%',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'Najnowsza wersja zostanie pobrana i otworzy się instalator.',
|
||||
'Download & Install': 'Pobierz i zainstaluj',
|
||||
'Update failed: {0}': 'Aktualizacja nie powiodła się: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} dostępna',
|
||||
'Updates': 'Aktualizacje',
|
||||
'Check for updates': 'Sprawdź aktualizacje',
|
||||
'Checking…': 'Sprawdzanie…',
|
||||
'You have v{0}': 'Masz v{0}',
|
||||
'Update to openGym v{0}': 'Zaktualizuj do openGym v{0}',
|
||||
'You have the latest version.': 'Masz najnowszą wersję.',
|
||||
'Could not check for updates — are you online?': 'Nie udało się sprawdzić — czy jesteś online?',
|
||||
'Get the Android app': 'Pobierz aplikację na Androida',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Pobierz APK z opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Wydania są sprawdzane na gitlab.com. Pobrany plik jest weryfikowany sumą kontrolną przed otwarciem instalatora.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'Aplikacja webowa aktualizuje się razem z serwerem. Aplikacja na Androida instaluje aktualizacje stąd.',
|
||||
'Starting download…': 'Rozpoczynanie pobierania…',
|
||||
'Downloading update…': 'Pobieranie aktualizacji…',
|
||||
'{0} %': '{0}%',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'A versão mais recente será transferida e o instalador será aberto.',
|
||||
'Download & Install': 'Transferir e instalar',
|
||||
'Update failed: {0}': 'Falha na atualização: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} disponível',
|
||||
'Updates': 'Atualizações',
|
||||
'Check for updates': 'Procurar atualizações',
|
||||
'Checking…': 'A verificar…',
|
||||
'You have v{0}': 'Tens a v{0}',
|
||||
'Update to openGym v{0}': 'Atualizar para o openGym v{0}',
|
||||
'You have the latest version.': 'Tens a versão mais recente.',
|
||||
'Could not check for updates — are you online?': 'Não foi possível verificar — estás online?',
|
||||
'Get the Android app': 'Obter a app Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Descarrega o APK em opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'As versões são verificadas em gitlab.com. A transferência é confirmada pela soma de verificação antes de abrir o instalador.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'A app web atualiza-se com o teu servidor. A app Android instala as suas atualizações a partir daqui.',
|
||||
'Starting download…': 'A iniciar transferência…',
|
||||
'Downloading update…': 'A transferir atualização…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'Последняя версия будет загружена и откроется установщик.',
|
||||
'Download & Install': 'Скачать и установить',
|
||||
'Update failed: {0}': 'Ошибка обновления: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} доступна',
|
||||
'Updates': 'Обновления',
|
||||
'Check for updates': 'Проверить обновления',
|
||||
'Checking…': 'Проверка…',
|
||||
'You have v{0}': 'У вас v{0}',
|
||||
'Update to openGym v{0}': 'Обновить до openGym v{0}',
|
||||
'You have the latest version.': 'У вас последняя версия.',
|
||||
'Could not check for updates — are you online?': 'Не удалось проверить — вы онлайн?',
|
||||
'Get the Android app': 'Скачать приложение для Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'Скачайте APK с opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Релизы проверяются на gitlab.com. Перед запуском установщика загрузка сверяется с контрольной суммой.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'Веб-приложение обновляется вместе с сервером. Приложение для Android устанавливает обновления отсюда.',
|
||||
'Starting download…': 'Начало загрузки…',
|
||||
'Downloading update…': 'Загрузка обновления…',
|
||||
'{0} %': '{0} %',
|
||||
|
||||
@@ -1202,7 +1202,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'เวอร์ชันล่าสุดจะถูกดาวน์โหลดและตัวติดตั้งจะเปิดขึ้น',
|
||||
'Download & Install': 'ดาวน์โหลดและติดตั้ง',
|
||||
'Update failed: {0}': 'อัปเดตล้มเหลว: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} พร้อมใช้งาน',
|
||||
'Updates': 'อัปเดต',
|
||||
'Check for updates': 'ตรวจสอบอัปเดต',
|
||||
'Checking…': 'กำลังตรวจสอบ…',
|
||||
'You have v{0}': 'คุณใช้ v{0}',
|
||||
'Update to openGym v{0}': 'อัปเดตเป็น openGym v{0}',
|
||||
'You have the latest version.': 'คุณใช้เวอร์ชันล่าสุดแล้ว',
|
||||
'Could not check for updates — are you online?': 'ตรวจสอบอัปเดตไม่ได้ — คุณออนไลน์อยู่ไหม?',
|
||||
'Get the Android app': 'รับแอป Android',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'ดาวน์โหลด APK จาก opengym.duarte-santos.ch',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'ตรวจสอบรุ่นจาก gitlab.com ไฟล์ที่ดาวน์โหลดจะถูกตรวจ checksum ก่อนเปิดตัวติดตั้ง',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'เว็บแอปอัปเดตพร้อมกับเซิร์ฟเวอร์ของคุณ แอป Android ติดตั้งอัปเดตจากที่นี่',
|
||||
'Starting download…': 'กำลังเริ่มดาวน์โหลด…',
|
||||
'Downloading update…': 'กำลังดาวน์โหลดอัปเดต…',
|
||||
'{0} %': '{0}%',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': 'En son sürüm indirilecek ve yükleyici açılacak.',
|
||||
'Download & Install': 'İndir ve Kur',
|
||||
'Update failed: {0}': 'Güncelleme başarısız: {0}',
|
||||
'openGym v{0} available': 'openGym v{0} mevcut',
|
||||
'Updates': 'Güncellemeler',
|
||||
'Check for updates': 'Güncellemeleri denetle',
|
||||
'Checking…': 'Denetleniyor…',
|
||||
'You have v{0}': 'Sürümün v{0}',
|
||||
'Update to openGym v{0}': 'openGym v{0} sürümüne güncelle',
|
||||
'You have the latest version.': 'En son sürüme sahipsin.',
|
||||
'Could not check for updates — are you online?': 'Denetlenemedi — çevrimiçi misin?',
|
||||
'Get the Android app': 'Android uygulamasını al',
|
||||
'Download the APK from opengym.duarte-santos.ch': 'APK’yı opengym.duarte-santos.ch adresinden indir',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': 'Sürümler gitlab.com üzerinde denetlenir. İndirme, yükleyici açılmadan önce sağlama toplamıyla doğrulanır.',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': 'Web uygulaması sunucunla birlikte güncellenir. Android uygulaması güncellemelerini buradan kurar.',
|
||||
'Starting download…': 'İndirme başlatılıyor…',
|
||||
'Downloading update…': 'Güncelleme indiriliyor…',
|
||||
'{0} %': '%{0}',
|
||||
|
||||
@@ -1191,7 +1191,17 @@ export default {
|
||||
'The latest version will be downloaded and the installer will open.': '将下载最新版本并打开安装程序。',
|
||||
'Download & Install': '下载并安装',
|
||||
'Update failed: {0}': '更新失败:{0}',
|
||||
'openGym v{0} available': 'openGym v{0} 可用',
|
||||
'Updates': '更新',
|
||||
'Check for updates': '检查更新',
|
||||
'Checking…': '正在检查…',
|
||||
'You have v{0}': '当前 v{0}',
|
||||
'Update to openGym v{0}': '更新到 openGym v{0}',
|
||||
'You have the latest version.': '已是最新版本。',
|
||||
'Could not check for updates — are you online?': '无法检查更新,你在线吗?',
|
||||
'Get the Android app': '获取 Android 应用',
|
||||
'Download the APK from opengym.duarte-santos.ch': '从 opengym.duarte-santos.ch 下载 APK',
|
||||
'Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.': '版本在 gitlab.com 上检查。安装程序打开前会校验下载文件的校验和。',
|
||||
'The web app updates together with your server. The Android app installs its own updates from here.': '网页应用随服务器一起更新。Android 应用在这里自行安装更新。',
|
||||
'Starting download…': '正在开始下载…',
|
||||
'Downloading update…': '正在下载更新…',
|
||||
'{0} %': '{0}%',
|
||||
|
||||
@@ -46,6 +46,8 @@ export default function Settings() {
|
||||
|
||||
// --- update check state ---
|
||||
const [updateInfo, setUpdateInfo] = useState(null) // { hasUpdate, latestVersion, apkUrl, hashUrl } | null
|
||||
const [android, setAndroid] = useState(false)
|
||||
const [checking, setChecking] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
// The in-app updater installs an .apk, so it only applies to the native Android build.
|
||||
@@ -53,9 +55,24 @@ export default function Settings() {
|
||||
// already answers false off the mobile build; the MOBILE check on top keeps the web bundle
|
||||
// from even asking (and from calling gitlab.com on every Settings visit).
|
||||
if (!MOBILE) return
|
||||
isAndroid().then(ok => { if (ok) checkForUpdate().then(setUpdateInfo).catch(() => {}) })
|
||||
isAndroid().then(ok => { setAndroid(ok); if (ok) checkForUpdate().then(setUpdateInfo).catch(() => {}) })
|
||||
}, [])
|
||||
|
||||
// The same check, on demand: the automatic one is silent when it finds nothing or cannot
|
||||
// reach gitlab.com, and a person who taps "Check for updates" deserves an answer either way.
|
||||
const checkNow = async () => {
|
||||
if (checking) return
|
||||
setChecking(true)
|
||||
try {
|
||||
const info = await checkForUpdate()
|
||||
setUpdateInfo(info)
|
||||
if (!info.hasUpdate) toast(t('You have the latest version.'))
|
||||
} catch {
|
||||
toast(t('Could not check for updates — are you online?'))
|
||||
}
|
||||
setChecking(false)
|
||||
}
|
||||
|
||||
const onUpdateRowClick = () => {
|
||||
if (!updateInfo?.hasUpdate) return
|
||||
if (updateInfo.apkUrl) {
|
||||
@@ -320,9 +337,6 @@ export default function Settings() {
|
||||
|
||||
{/* ---------- data: fill it, bring things over, back it up, wipe it ---------- */}
|
||||
<Section title={t('Data')}>
|
||||
{MOBILE && updateInfo?.hasUpdate && updateInfo.apkUrl && <Row icon="info" iconTint="var(--purple)" title={t('openGym v{0} available', updateInfo.latestVersion)}
|
||||
accessory="chevron"
|
||||
onClick={onUpdateRowClick} />}
|
||||
<Row icon="sparkles" iconTint="var(--acc)" title={t('Load starter plan')} accessory="chevron" onClick={starterPlanSheet} />
|
||||
<Row icon="shuffle" iconTint="var(--teal)" title={t('Import from another app')}
|
||||
subtitle={t('FitNotes, Strong, Hevy — or body weight from Apple Health')}
|
||||
@@ -350,6 +364,23 @@ export default function Settings() {
|
||||
subtitle={t('to install openGym as a full-screen app.') + ' ' + (user ? t('Your data syncs with your profile — sign in anywhere to see it.') : t('Guest data stays on this device — export a backup now and then!'))} />
|
||||
</Section>}
|
||||
|
||||
{/* ---------- updates: the last thing on the page, so keeping openGym current is one tap ----------
|
||||
On Android the row is always there — it checks on demand and installs when a release is
|
||||
newer (checksum verified, see onUpdateRowClick). On the web the app updates with its
|
||||
server, so the row points at the APK for the phone instead. iOS has no APK: nothing. */}
|
||||
{(!MOBILE || android) && <Section title={t('Updates')}
|
||||
footer={MOBILE ? t('Releases are checked on gitlab.com. The download is verified against its checksum before the installer opens.') : t('The web app updates together with your server. The Android app installs its own updates from here.')}>
|
||||
{MOBILE
|
||||
? <Row icon="download" iconTint="var(--acc)"
|
||||
title={updateInfo?.hasUpdate ? t('Update to openGym v{0}', updateInfo.latestVersion) : t('Check for updates')}
|
||||
subtitle={checking ? t('Checking…') : t('You have v{0}', __APP_VERSION__)}
|
||||
accessory="chevron"
|
||||
onClick={() => (updateInfo?.hasUpdate ? onUpdateRowClick() : checkNow())} />
|
||||
: <Row icon="download" iconTint="var(--acc)" title={t('Get the Android app')}
|
||||
subtitle={t('Download the APK from opengym.duarte-santos.ch')} accessory="chevron"
|
||||
onClick={() => window.open('https://opengym.duarte-santos.ch/#download', '_blank', 'noopener')} />}
|
||||
</Section>}
|
||||
|
||||
{/* The version, at the bottom of Settings — which is where the support template has been
|
||||
telling people to look for it, and where it was not. On the phone build there is no
|
||||
address bar and no about box, so without this there is no way to tell which build you
|
||||
|
||||
@@ -86,20 +86,26 @@ const mount = async () => {
|
||||
await act(async () => { root.render(<Settings />) })
|
||||
await act(async () => { await Promise.resolve(); await Promise.resolve() })
|
||||
}
|
||||
const updateRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('openGym v9.9.9 available'))
|
||||
const updateRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Update to openGym v9.9.9'))
|
||||
const checkRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Check for updates'))
|
||||
const webRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Get the Android app'))
|
||||
|
||||
describe('Settings — in-app update check', () => {
|
||||
it('web build: never asks for releases and shows no update row', async () => {
|
||||
it('web build: never asks for releases; the Updates section points at the APK instead', async () => {
|
||||
await mount()
|
||||
expect(mocks.checkForUpdate).not.toHaveBeenCalled()
|
||||
expect(updateRow()).toBeUndefined()
|
||||
expect(checkRow()).toBeUndefined()
|
||||
expect(webRow()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('mobile build on iOS: no check, no row', async () => {
|
||||
it('mobile build on iOS: no check, no row, no section', async () => {
|
||||
mocks.MOBILE = true
|
||||
await mount()
|
||||
expect(mocks.checkForUpdate).not.toHaveBeenCalled()
|
||||
expect(updateRow()).toBeUndefined()
|
||||
expect(checkRow()).toBeUndefined()
|
||||
expect(webRow()).toBeUndefined()
|
||||
})
|
||||
|
||||
it('mobile build on Android: checks once and shows the row, tapping it asks before downloading', async () => {
|
||||
@@ -113,20 +119,26 @@ describe('Settings — in-app update check', () => {
|
||||
expect(mocks.confirmSheet.mock.calls[0][0].title).toBe('Update to 9.9.9?')
|
||||
})
|
||||
|
||||
it('Android without a newer release: no row', async () => {
|
||||
it('Android without a newer release: a "Check for updates" row stays, and tapping it checks again', async () => {
|
||||
mocks.MOBILE = true
|
||||
mocks.android = true
|
||||
mocks.checkForUpdate.mockResolvedValueOnce({ hasUpdate: false, latestVersion: 'test', apkUrl: null, hashUrl: null })
|
||||
await mount()
|
||||
expect(mocks.checkForUpdate).toHaveBeenCalledTimes(1)
|
||||
expect(updateRow()).toBeUndefined()
|
||||
expect(checkRow()).toBeTruthy()
|
||||
await act(async () => { checkRow().click(); await Promise.resolve() })
|
||||
expect(mocks.checkForUpdate).toHaveBeenCalledTimes(2)
|
||||
await act(async () => { await Promise.resolve() })
|
||||
expect(updateRow()).toBeTruthy() // the second (default) answer had 9.9.9 — the row now offers it
|
||||
})
|
||||
|
||||
it('Android when gitlab.com is unreachable: stays quiet', async () => {
|
||||
it('Android when gitlab.com is unreachable: stays quiet, keeps the row', async () => {
|
||||
mocks.MOBILE = true
|
||||
mocks.android = true
|
||||
mocks.checkForUpdate.mockRejectedValueOnce(new Error('offline'))
|
||||
await mount()
|
||||
expect(updateRow()).toBeUndefined()
|
||||
expect(checkRow()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user