From bf9764e3a225758710e42946f60cdfceb3266ee6 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Mon, 7 Sep 2026 19:45:19 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 23 +++++ frontend/public/deload-demo.html | 104 -------------------- frontend/src/lib/pt-br-locale.test.js | 4 +- frontend/src/locales/de.js | 12 ++- frontend/src/locales/es.js | 12 ++- frontend/src/locales/fr.js | 12 ++- frontend/src/locales/hi.js | 12 ++- frontend/src/locales/hu.js | 12 ++- frontend/src/locales/it.js | 12 ++- frontend/src/locales/ko.js | 12 ++- frontend/src/locales/pl.js | 12 ++- frontend/src/locales/pt.js | 12 ++- frontend/src/locales/ru.js | 12 ++- frontend/src/locales/th.js | 12 ++- frontend/src/locales/tr.js | 12 ++- frontend/src/locales/zh.js | 12 ++- frontend/src/views/Settings.jsx | 39 +++++++- frontend/src/views/Settings.update.test.jsx | 22 ++++- 18 files changed, 220 insertions(+), 128 deletions(-) delete mode 100644 frontend/public/deload-demo.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 633bfa8..61e6020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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, diff --git a/frontend/public/deload-demo.html b/frontend/public/deload-demo.html deleted file mode 100644 index f87e83a..0000000 --- a/frontend/public/deload-demo.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - openGym Epley deload demo - - - -

Epley-based automatic deload

-

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.

-
- - - -
-
-
- What to check - -
Formula: 1RM = weight × (1 + reps / 30); deload target = estimated 1RM × 0.9.
-
- - - \ No newline at end of file diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js index 55f1572..e066fe7 100644 --- a/frontend/src/lib/pt-br-locale.test.js +++ b/frontend/src/lib/pt-br-locale.test.js @@ -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', () => { diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index e5dc0e6..13faa20 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -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} %', diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 2c4b2f8..2d1890c 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -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} %', diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index b7ff04a..3afb5ac 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -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} %', diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index e5b31e6..b3419cf 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -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}%', diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js index ac65287..4b53982 100644 --- a/frontend/src/locales/hu.js +++ b/frontend/src/locales/hu.js @@ -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} %', diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index 893eba5..46c2da4 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -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} %', diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index 1dab36b..9166faf 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -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}%', diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index 3d3854d..d28366b 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -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}%', diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index 16a9996..a68b162 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -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} %', diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 7af9e4e..6ec0ef4 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -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} %', diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js index 0c355d9..0e72532 100644 --- a/frontend/src/locales/th.js +++ b/frontend/src/locales/th.js @@ -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}%', diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index ea86e85..f5cba8d 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -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}', diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index ea453c0..1fad446 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -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}%', diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx index 854c7cc..21b2fb9 100644 --- a/frontend/src/views/Settings.jsx +++ b/frontend/src/views/Settings.jsx @@ -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 ---------- */}
- {MOBILE && updateInfo?.hasUpdate && updateInfo.apkUrl && }
} + {/* ---------- 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) &&
+ {MOBILE + ? (updateInfo?.hasUpdate ? onUpdateRowClick() : checkNow())} /> + : window.open('https://opengym.duarte-santos.ch/#download', '_blank', 'noopener')} />} +
} + {/* 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 diff --git a/frontend/src/views/Settings.update.test.jsx b/frontend/src/views/Settings.update.test.jsx index b4ec847..765cc5e 100644 --- a/frontend/src/views/Settings.update.test.jsx +++ b/frontend/src/views/Settings.update.test.jsx @@ -86,20 +86,26 @@ const mount = async () => { await act(async () => { root.render() }) 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() }) })