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
settings: a failed Disconnect or Sign out says so, not "sign out everywhere"
Boris 'B' Kurktchiev094749ae0a25
diff --git a/frontend/src/components/ServerSync.jsx b/frontend/src/components/ServerSync.jsxindex 4e3fa09a7..8e95c8c86 100644--- a/frontend/src/components/ServerSync.jsx+++ b/frontend/src/components/ServerSync.jsx@@ -146,14 +146,14 @@ export async function passkeySignIn() {the device until it reaches this server as this account again. `done(result)` runs once thedevice has actually left. */const LEAVE = {- disconnect: { run: (st, o) => st.disconnectServer(o), anyway: () => t('Disconnect anyway') },- signout: { run: (st, o) => st.signOut(o), anyway: () => t('Sign out anyway') },- everywhere: { run: (st, o) => st.signOutAll(o), anyway: () => t('Sign out anyway') },+ disconnect: { run: (st, o) => st.disconnectServer(o), anyway: () => t('Disconnect anyway'), failed: () => t('Couldn’t disconnect. You’re still connected.') },+ signout: { run: (st, o) => st.signOut(o), anyway: () => t('Sign out anyway'), failed: () => t('Couldn’t sign out. You’re still signed in.') },+ everywhere: { run: (st, o) => st.signOutAll(o), anyway: () => t('Sign out anyway'), failed: () => t('Couldn’t sign out everywhere. You’re still signed in.') },}async function attempt(kind, opts) {try { return await LEAVE[kind].run(useStore.getState(), opts) }- catch (e) { // only "sign out everywhere" throws: the other sessions are all still valid- toast(t('Couldn’t sign out everywhere. You’re still signed in.'))+ catch (e) { // only a local failure lands here (signOut swallows a failed logout request); each says which action it was+ toast(LEAVE[kind].failed())return null}}diff --git a/frontend/src/components/ServerSync.leave.test.jsx b/frontend/src/components/ServerSync.leave.test.jsxnew file mode 100644index 000000000..d7b704732--- /dev/null+++ b/frontend/src/components/ServerSync.leave.test.jsx@@ -0,0 +1,74 @@+// @vitest-environment happy-dom+import React, { act } from 'react'+import { createRoot } from 'react-dom/client'+import { beforeEach, describe, expect, it, vi } from 'vitest'++globalThis.IS_REACT_ACT_ENVIRONMENT = true++/* When Disconnect, Sign out or Sign out everywhere fails, the toast says what that action was and+ what still stands: "Sign out everywhere" was the only wording, whichever one had failed. */+const mocks = vi.hoisted(() => ({ toast: null, disconnectServer: null, signOut: null, signOutAll: null }))+vi.mock('../store/useStore.js', () => {+ const snap = () => ({+ sync: null, config: null, syncNow: async () => null,+ disconnectServer: (...a) => mocks.disconnectServer(...a),+ signOut: (...a) => mocks.signOut(...a),+ signOutAll: (...a) => mocks.signOutAll(...a)+ })+ const useStore = selector => (selector ? selector(snap()) : snap())+ useStore.getState = snap+ return { useStore }+})+vi.mock('../store/useUI.js', () => {+ const snap = () => ({ toast: m => mocks.toast(m), openSheet: vi.fn() })+ const useUI = selector => (selector ? selector(snap()) : snap())+ useUI.getState = snap+ return { useUI }+})+vi.mock('../lib/media-sync.js', () => ({ syncMedia: vi.fn() }))+vi.mock('../lib/mobile.js', () => ({ MOBILE: false }))+vi.mock('../lib/api.js', () => ({ passkeyLogin: vi.fn(), webauthnOK: () => true }))+vi.mock('../sheets.jsx', () => ({ askAddDeviceData: vi.fn() }))+vi.mock('../views/MobileOnboarding.jsx', () => ({ ConnectSheet: () => null }))++const { leaveServer, OwedSheet } = await import('./ServerSync.jsx')++const fail = () => vi.fn(async () => { throw new Error('boom') })+beforeEach(() => {+ mocks.toast = vi.fn()+ mocks.disconnectServer = fail()+ mocks.signOut = fail()+ mocks.signOutAll = fail()+})++describe('leaving the server, when it fails', () => {+ it.each([+ ['disconnect', 'disconnectServer', 'Couldn’t disconnect. You’re still connected.'],+ ['signout', 'signOut', 'Couldn’t sign out. You’re still signed in.'],+ ['everywhere', 'signOutAll', 'Couldn’t sign out everywhere. You’re still signed in.']+ ])('%s says its own words and leaves the screen where it is', async (kind, method, line) => {+ const done = vi.fn()+ await leaveServer(kind, { exportBackup: vi.fn(), exportBackupZip: vi.fn(), done })+ expect(mocks[method]).toHaveBeenCalledTimes(1)+ expect(mocks.toast).toHaveBeenCalledTimes(1)+ expect(mocks.toast).toHaveBeenCalledWith(line)+ expect(done).not.toHaveBeenCalled()+ })+})++describe('the sheet that offers going ahead anyway, when that fails', () => {+ it.each([+ ['disconnect', 'disconnectServer', 'Disconnect anyway', 'Couldn’t disconnect. You’re still connected.'],+ ['signout', 'signOut', 'Sign out anyway', 'Couldn’t sign out. You’re still signed in.']+ ])('%s says its own words', async (kind, method, label, line) => {+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ act(() => root.render(<OwedSheet kind={kind} count={2} exportBackup={vi.fn()} exportBackupZip={vi.fn()} done={vi.fn()} close={vi.fn()} />))+ const btn = [...host.querySelectorAll('button')].find(b => b.textContent.includes(label))+ await act(async () => { btn.click() })+ expect(mocks[method]).toHaveBeenCalledWith({ force: true })+ expect(mocks.toast).toHaveBeenCalledWith(line)+ act(() => root.unmount()); host.remove()+ })+})diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex b92f6745e..beb82d7ff 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -291,6 +291,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'ينهي جلسات هذا الملف الشخصي على جميع أجهزتك.','Signed out on all devices': 'تم تسجيل الخروج من جميع الأجهزة','Couldn’t sign out everywhere. You’re still signed in.': 'تعذّر تسجيل الخروج من كل الأجهزة. ما زلت مسجّلًا الدخول.',+ 'Couldn’t sign out. You’re still signed in.': 'تعذّر تسجيل الخروج. ما زلت مسجّلًا الدخول.',+ 'Couldn’t disconnect. You’re still connected.': 'تعذّر قطع الاتصال. ما زلت متصلًا.','Create passkey profile': 'إنشاء ملف شخصي بمفتاح مرور','Passkeys not supported in this browser.': 'مفاتيح المرور غير مدعومة في هذا المتصفح.','synced with your profile': 'متزامن مع ملفك الشخصي',diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 7fdb20e04..9cd195067 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -434,6 +434,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Beendet die Sitzungen dieses Profils auf all deinen Geräten.','Signed out on all devices': 'Auf allen Geräten abgemeldet','Couldn’t sign out everywhere. You’re still signed in.': 'Abmelden auf allen Geräten fehlgeschlagen. Du bist weiterhin angemeldet.',+ 'Couldn’t sign out. You’re still signed in.': 'Abmelden fehlgeschlagen. Du bist weiterhin angemeldet.',+ 'Couldn’t disconnect. You’re still connected.': 'Trennen fehlgeschlagen. Du bist weiterhin verbunden.','Create passkey profile': 'Passkey-Profil erstellen','Passkeys not supported in this browser.': 'Passkeys werden in diesem Browser nicht unterstützt.','synced with your profile': 'mit deinem Profil synchronisiert',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 592a333e1..ee20c33ff 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Termina las sesiones de este perfil en todos tus dispositivos.','Signed out on all devices': 'Sesión cerrada en todos los dispositivos','Couldn’t sign out everywhere. You’re still signed in.': 'No se pudo cerrar la sesión en todos los dispositivos. Sigues con la sesión iniciada.',+ 'Couldn’t sign out. You’re still signed in.': 'No se pudo cerrar la sesión. Sigues con la sesión iniciada.',+ 'Couldn’t disconnect. You’re still connected.': 'No se pudo desconectar. Sigues conectado.','Create passkey profile': 'Crear perfil con passkey','Passkeys not supported in this browser.': 'Passkeys no compatibles con este navegador.','synced with your profile': 'sincronizado con tu perfil',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex a6c2a3d84..0e0a942f8 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Met fin aux sessions de ce profil sur tous tes appareils.','Signed out on all devices': 'Déconnecté sur tous les appareils','Couldn’t sign out everywhere. You’re still signed in.': 'Impossible de se déconnecter partout. Tu es toujours connecté.',+ 'Couldn’t sign out. You’re still signed in.': 'Impossible de se déconnecter. Tu es toujours connecté.',+ 'Couldn’t disconnect. You’re still connected.': 'Impossible de se déconnecter du serveur. Tu es toujours connecté au serveur.','Create passkey profile': 'Créer un profil passkey','Passkeys not supported in this browser.': 'Passkeys non prises en charge par ce navigateur.','synced with your profile': 'synchronisé avec ton profil',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 8c05a4933..c29ff1dda 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'आपके सभी डिवाइस पर इस प्रोफ़ाइल के सेशन खत्म करता है।','Signed out on all devices': 'सभी डिवाइस पर साइन आउट हो गया','Couldn’t sign out everywhere. You’re still signed in.': 'हर जगह साइन आउट नहीं हो सका। आप अभी भी साइन इन हैं।',+ 'Couldn’t sign out. You’re still signed in.': 'साइन आउट नहीं हो सका। आप अभी भी साइन इन हैं।',+ 'Couldn’t disconnect. You’re still connected.': 'डिस्कनेक्ट नहीं हो सका। आप अभी भी कनेक्ट हैं।','Create passkey profile': 'पासकी प्रोफ़ाइल बनाएँ','Passkeys not supported in this browser.': 'इस ब्राउज़र में पासकी समर्थित नहीं।','synced with your profile': 'प्रोफ़ाइल से सिंक',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 3b8a3698f..7e5aa9bec 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -425,6 +425,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Lezárja ennek a profilnak a munkameneteit minden eszközödön.','Signed out on all devices': 'Kijelentkezve minden eszközön','Couldn’t sign out everywhere. You’re still signed in.': 'Nem sikerült mindenhonnan kijelentkezni. Továbbra is be vagy jelentkezve.',+ 'Couldn’t sign out. You’re still signed in.': 'Nem sikerült kijelentkezni. Továbbra is be vagy jelentkezve.',+ 'Couldn’t disconnect. You’re still connected.': 'Nem sikerült leválasztani. Továbbra is csatlakozva vagy.','Create passkey profile': 'Jelszókulcs-profil létrehozása','Passkeys not supported in this browser.': 'A jelszókulcsok nem támogatottak ebben a böngészőben.','synced with your profile': 'szinkronizálva a profiloddal',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 81f392217..2dac49a54 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Chiude le sessioni di questo profilo su tutti i tuoi dispositivi.','Signed out on all devices': 'Uscito da tutti i dispositivi','Couldn’t sign out everywhere. You’re still signed in.': 'Impossibile uscire ovunque. Sei ancora connesso.',+ 'Couldn’t sign out. You’re still signed in.': 'Impossibile uscire. Sei ancora connesso.',+ 'Couldn’t disconnect. You’re still connected.': 'Impossibile disconnettersi dal server. Sei ancora connesso al server.','Create passkey profile': 'Crea profilo passkey','Passkeys not supported in this browser.': 'Passkey non supportate in questo browser.','synced with your profile': 'sincronizzato col tuo profilo',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex fc4f356c8..302e2e799 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': '모든 기기에서 이 프로필의 세션을 종료합니다.','Signed out on all devices': '모든 기기에서 로그아웃했습니다','Couldn’t sign out everywhere. You’re still signed in.': '모든 기기에서 로그아웃하지 못했습니다. 아직 로그인 상태입니다.',+ 'Couldn’t sign out. You’re still signed in.': '로그아웃하지 못했습니다. 아직 로그인 상태입니다.',+ 'Couldn’t disconnect. You’re still connected.': '연결을 해제하지 못했습니다. 아직 연결된 상태입니다.','Create passkey profile': '패스키 프로필 만들기','Passkeys not supported in this browser.': '이 브라우저는 패스키를 지원하지 않습니다.','synced with your profile': '프로필과 동기화됨',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 92579d18f..b3cd6b5b5 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Kończy sesje tego profilu na wszystkich Twoich urządzeniach.','Signed out on all devices': 'Wylogowano na wszystkich urządzeniach','Couldn’t sign out everywhere. You’re still signed in.': 'Nie udało się wylogować wszędzie. Nadal jesteś zalogowany.',+ 'Couldn’t sign out. You’re still signed in.': 'Nie udało się wylogować. Nadal jesteś zalogowany.',+ 'Couldn’t disconnect. You’re still connected.': 'Nie udało się rozłączyć. Nadal jesteś połączony.','Create passkey profile': 'Utwórz profil passkey','Passkeys not supported in this browser.': 'Passkey nieobsługiwane w tej przeglądarce.','synced with your profile': 'synchronizowane z profilem',diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex c2c52d5f7..0fefc3dd6 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -136,6 +136,8 @@ export const PT_BR_OVERRIDES = {'Ends this profile’s sessions on all your devices.': 'Encerra as sessões deste perfil em todos os seus dispositivos.','Signed out on all devices': 'Sessão encerrada em todos os dispositivos','Couldn’t sign out everywhere. You’re still signed in.': 'Não foi possível sair de todos os dispositivos. Sua sessão continua ativa.',+ 'Couldn’t sign out. You’re still signed in.': 'Não foi possível sair. Sua sessão continua ativa.',+ 'Couldn’t disconnect. You’re still connected.': 'Não foi possível desconectar. Você continua conectado.','Create passkey profile': 'Criar perfil com chave de acesso','synced with your profile': 'sincronizado com seu perfil','The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'A tela permanece ligada durante o treino, para você não precisar desbloquear o celular entre as séries.',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex ad06595ac..dde94a6ed 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Termina as sessões deste perfil em todos os teus dispositivos.','Signed out on all devices': 'Sessão terminada em todos os dispositivos','Couldn’t sign out everywhere. You’re still signed in.': 'Não foi possível terminar a sessão em todos os dispositivos. Continuas com sessão iniciada.',+ 'Couldn’t sign out. You’re still signed in.': 'Não foi possível terminar a sessão. Continuas com sessão iniciada.',+ 'Couldn’t disconnect. You’re still connected.': 'Não foi possível desligar do servidor. Continuas ligado ao servidor.','Create passkey profile': 'Criar perfil com passkey','Passkeys not supported in this browser.': 'Passkeys não suportadas neste navegador.','synced with your profile': 'sincronizado com o teu perfil',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 576e5cbe6..a96c38795 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -409,6 +409,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Завершает сеансы этого профиля на всех твоих устройствах.','Signed out on all devices': 'Выход выполнен на всех устройствах','Couldn’t sign out everywhere. You’re still signed in.': 'Не удалось выйти на всех устройствах. Ты всё ещё в системе.',+ 'Couldn’t sign out. You’re still signed in.': 'Не удалось выйти. Ты всё ещё в системе.',+ 'Couldn’t disconnect. You’re still connected.': 'Не удалось отключиться. Соединение с сервером всё ещё активно.','Create passkey profile': 'Создать профиль с ключом доступа','Passkeys not supported in this browser.': 'Ключи доступа не поддерживаются в этом браузере.','synced with your profile': 'синхронизируется с профилем',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 1031f9448..a32ba1ed0 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -425,6 +425,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'จะยุติเซสชันของโปรไฟล์นี้ในทุกอุปกรณ์ของคุณ','Signed out on all devices': 'ออกจากระบบทุกอุปกรณ์แล้ว','Couldn’t sign out everywhere. You’re still signed in.': 'ออกจากระบบทุกอุปกรณ์ไม่สำเร็จ คุณยังเข้าสู่ระบบอยู่',+ 'Couldn’t sign out. You’re still signed in.': 'ออกจากระบบไม่สำเร็จ คุณยังเข้าสู่ระบบอยู่',+ 'Couldn’t disconnect. You’re still connected.': 'ยกเลิกการเชื่อมต่อไม่สำเร็จ คุณยังเชื่อมต่ออยู่','Create passkey profile': 'สร้างโปรไฟล์พาสคีย์','Passkeys not supported in this browser.': 'เบราว์เซอร์นี้ไม่รองรับพาสคีย์','synced with your profile': 'ซิงค์กับโปรไฟล์ของคุณ',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex d6fa067cf..91d321aea 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Bu profilin tüm cihazlarındaki oturumlarını sonlandırır.','Signed out on all devices': 'Tüm cihazlarda çıkış yapıldı','Couldn’t sign out everywhere. You’re still signed in.': 'Her yerden çıkış yapılamadı. Hâlâ giriş yapmış durumdasın.',+ 'Couldn’t sign out. You’re still signed in.': 'Çıkış yapılamadı. Hâlâ giriş yapmış durumdasın.',+ 'Couldn’t disconnect. You’re still connected.': 'Bağlantı kesilemedi. Hâlâ bağlısın.','Create passkey profile': 'Geçiş anahtarlı profil oluştur','Passkeys not supported in this browser.': 'Bu tarayıcıda geçiş anahtarları desteklenmiyor.','synced with your profile': 'profilinle eşitlenir',diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex a4a775ede..d141d7006 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -273,6 +273,8 @@ export default {'Ends this profile’s sessions on all your devices.': 'Завершує сеанси цього профілю на всіх твоїх пристроях.','Signed out on all devices': 'Вихід виконано на всіх пристроях','Couldn’t sign out everywhere. You’re still signed in.': 'Не вдалося вийти на всіх пристроях. Ти все ще в системі.',+ 'Couldn’t sign out. You’re still signed in.': 'Не вдалося вийти. Ти все ще в системі.',+ 'Couldn’t disconnect. You’re still connected.': 'Не вдалося відключитися. З’єднання з сервером досі активне.','Create passkey profile': 'Створити профіль із ключем доступу','Passkeys not supported in this browser.': 'Ключі доступу не підтримуються в цьому браузері.','synced with your profile': 'синхронізується з профілем',diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex 0ab17d0bf..a602de6bc 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -415,6 +415,8 @@ export default {'Ends this profile’s sessions on all your devices.': '結束此個人檔案在所有裝置上的登入階段。','Signed out on all devices': '已在所有裝置上登出','Couldn’t sign out everywhere. You’re still signed in.': '無法在所有裝置上登出。你目前仍保持登入狀態。',+ 'Couldn’t sign out. You’re still signed in.': '無法登出。你目前仍保持登入狀態。',+ 'Couldn’t disconnect. You’re still connected.': '無法中斷連線。你目前仍保持連線狀態。','Create passkey profile': '建立通行密鑰個人檔案','Passkeys not supported in this browser.': '此瀏覽器不支援通行密鑰。','synced with your profile': '已與個人檔案同步',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 07765586e..7e75ab3dc 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -419,6 +419,8 @@ export default {'Ends this profile’s sessions on all your devices.': '结束此档案在你所有设备上的会话。','Signed out on all devices': '已在所有设备上退出登录','Couldn’t sign out everywhere. You’re still signed in.': '无法在所有设备上退出登录。你仍处于登录状态。',+ 'Couldn’t sign out. You’re still signed in.': '无法退出登录。你仍处于登录状态。',+ 'Couldn’t disconnect. You’re still connected.': '无法断开连接。你仍处于连接状态。','Create passkey profile': '创建通行密钥档案','Passkeys not supported in this browser.': '此浏览器不支持通行密钥。','synced with your profile': '与档案同步',