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
Auto-backup: the subtitle names the chosen folder, the lost-folder warning at row-text size
Duarte Santos9445e97b1d9c
diff --git a/frontend/src/components/BackupFolderRow.jsx b/frontend/src/components/BackupFolderRow.jsxindex 2a1e131c2..8957a295e 100644--- a/frontend/src/components/BackupFolderRow.jsx+++ b/frontend/src/components/BackupFolderRow.jsx@@ -11,14 +11,31 @@ const DEFAULT_FOLDER = 'Documents/openGym'(lib/mobile.js), so it is read here and not from the synced state. When the chosen folderstops taking copies they go to Documents/openGym again, and this says so until the folder ischosen again or the default is confirmed. */-export default function BackupFolderRow() {+export function useBackupFolder(enabled = true) {const [folder, setFolder] = useState(null)useEffect(() => {+ if (!enabled) return undefinedlet live = true- backupFolder().then(f => { if (live) setFolder(f) }).catch(() => { if (live) setFolder({}) })- const off = onBackupFolderChange(f => { if (live) setFolder(f) })+ let off = () => {}+ try {+ backupFolder().then(f => { if (live) setFolder(f) }).catch(() => { if (live) setFolder({}) })+ off = onBackupFolderChange(f => { if (live) setFolder(f) })+ } catch (e) { setFolder({}) }return () => { live = false; off() }- }, [])+ }, [enabled])+ return [folder, setFolder]+}++/* The Auto-backup row's subtitle names where the copies go: the chosen folder once there is one,+ not Documents/openGym regardless (Android QA). `keep` is AUTO_BACKUP_KEEP. */+export function autoBackupSubtitle(folder, keep) {+ if (folder?.uri && folder.label) return t('Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.', folder.label, keep)+ if (folder?.uri) return t('Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.', keep)+ return t('Saves a dated copy to Documents/openGym after finishing a workout or editing a routine, and keeps the newest {0}. Point a sync app at that folder, or copy it out by hand.', keep)+}++export default function BackupFolderRow() {+ const [folder, setFolder] = useBackupFolder()if (!folder) return nullconst choose = async () => {diff --git a/frontend/src/components/BackupFolderRow.test.jsx b/frontend/src/components/BackupFolderRow.test.jsxindex b89a96218..07e6da236 100644--- a/frontend/src/components/BackupFolderRow.test.jsx+++ b/frontend/src/components/BackupFolderRow.test.jsx@@ -66,3 +66,24 @@ describe('BackupFolderRow', () => {expect(host.querySelector('.backup-lost')).toBeNull()})})++// Android QA: after another folder was chosen, the Auto-backup row still said Documents/openGym.+describe('the Auto-backup subtitle', () => {+ it('names the chosen folder, or the default', async () => {+ const { autoBackupSubtitle } = await import('./BackupFolderRow.jsx')+ expect(autoBackupSubtitle({ uri: 'content://tree/Sync', label: 'SyncFolder' }, 14))+ .toBe('Saves a dated copy to “SyncFolder” after finishing a workout or editing a routine, and keeps the newest 14.')+ expect(autoBackupSubtitle({ uri: 'content://tree/x' }, 14))+ .toBe('Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest 14.')+ for (const f of [{}, null, { lost: true, lostLabel: 'SyncFolder' }]) expect(autoBackupSubtitle(f, 14)).toContain('Documents/openGym')+ })++ it('the lost-folder warning is a warning row, not a big title', async () => {+ m.folder = { lost: true, lostLabel: 'SyncFolder' }+ await mount()+ const warn = host.querySelector('.lrow.backup-lost')+ expect(warn.textContent).toContain('SyncFolder')+ const css = (await import('node:fs')).readFileSync(process.cwd() + '/src/index.css', 'utf8')+ expect(css).toMatch(/\.lrow\.backup-lost \.lrow-t\{font-size:13px/)+ })+})diff --git a/frontend/src/index.css b/frontend/src/index.cssindex 57441a956..6efe40355 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -330,6 +330,8 @@ h4.sec{.lrow-c{color:var(--label);font-size:15px;flex:none;--icon-stroke:2.4}.lrow-k{color:var(--acc);font-size:17px;flex:none;--icon-stroke:2.4}.lrow.danger,.lrow.danger .lrow-t{color:var(--red)}+/* A warning under a settings row reads at subtitle size: a sentence, not a row title. */+.lrow.backup-lost .lrow-t{font-size:13px;line-height:1.3;color:var(--label-2);letter-spacing:0}/* The Stats exercise name gets its own line so long names cannot run into the title.Two columns only — label/value on the left, chevron on the right — so this is for rowsWITHOUT an icon. `.lrow-i` is not placed here; on a row that has one it would auto-placediff --git a/frontend/src/lib/mobile.autobackup.test.js b/frontend/src/lib/mobile.autobackup.test.jsindex bf9c765ed..600efab44 100644--- a/frontend/src/lib/mobile.autobackup.test.js+++ b/frontend/src/lib/mobile.autobackup.test.js@@ -145,6 +145,7 @@ describe('writeAutoBackup where today\'s name belongs to another install', () =>it('the Settings subtitle names the same number of copies the pruning keeps', async () => {const fs = await import('node:fs')const src = fs.readFileSync(new URL('../views/Settings.jsx', import.meta.url), 'utf8')- const m = src.match(/keeps the newest \{0\}[^']*', (\d+)\)/)+ // autoBackupSubtitle(folder, keep) (components/BackupFolderRow.jsx) fills in every wording+ const m = src.match(/autoBackupSubtitle\([^)]*, (\d+)\)/)expect(m && Number(m[1])).toBe(AUTO_BACKUP_KEEP)})diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex 8963ce0ed..2f31815c1 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -1846,4 +1846,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'عضلاتك أبلغت عن فقدانك. احضر إلى {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'هذا العنوان يستجيب، لكنه ليس خادم openGym. تحقّق من الرابط.','Switch sides': 'بدّل الجهة',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'يحفظ نسخة مؤرّخة في «{0}» بعد إنهاء تمرين أو تعديل روتين، ويحتفظ بأحدث {1}.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'يحفظ نسخة مؤرّخة في المجلد الذي اخترته بعد إنهاء تمرين أو تعديل روتين، ويحتفظ بأحدث {0}.',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 69dd8b1c9..cb0ae287b 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1813,4 +1813,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Deine Muskeln haben eine Vermisstenanzeige aufgegeben. Antreten zu {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'Unter dieser Adresse antwortet etwas, aber kein openGym-Server. Prüf die URL.','Switch sides': 'Seite wechseln',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Speichert nach jedem beendeten Training oder jeder bearbeiteten Routine eine datierte Kopie in „{0}“ und behält die neuesten {1}.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Speichert nach jedem beendeten Training oder jeder bearbeiteten Routine eine datierte Kopie im gewählten Ordner und behält die neuesten {0}.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex b7c0c6315..e07d0ae72 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Tus músculos pusieron una denuncia por desaparición. ¡Preséntate a {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'Esa dirección responde, pero no es un servidor de openGym. Revisa la URL.','Switch sides': 'Cambia de lado',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Guarda una copia con fecha en «{0}» al terminar un entreno o editar una rutina, y conserva las {1} más recientes.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Guarda una copia con fecha en la carpeta que elegiste al terminar un entreno o editar una rutina, y conserva las {0} más recientes.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 700e2e74d..2e4313e87 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Vos muscles ont signalé votre disparition. Présentez-vous pour {0} !','That address answers, but it isn’t an openGym server. Check the URL.': 'Cette adresse répond, mais ce n’est pas un serveur openGym. Vérifie l’URL.','Switch sides': 'Change de côté',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Enregistre une copie datée dans « {0} » après chaque séance terminée ou routine modifiée, et garde les {1} plus récentes.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Enregistre une copie datée dans le dossier choisi après chaque séance terminée ou routine modifiée, et garde les {0} plus récentes.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex f57a8f31b..be286da49 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'आपकी मांसपेशियों ने गुमशुदगी की रिपोर्ट लिखाई है। {0} के लिए हाज़िर हो!','That address answers, but it isn’t an openGym server. Check the URL.': 'यह पता जवाब देता है, लेकिन यह openGym सर्वर नहीं है। URL जाँचें।','Switch sides': 'साइड बदलें',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'हर वर्कआउट पूरा होने या रूटीन बदलने के बाद “{0}” में तारीख वाली कॉपी सेव करता है और सबसे नई {1} रखता है।',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'हर वर्कआउट पूरा होने या रूटीन बदलने के बाद आपके चुने फ़ोल्डर में तारीख वाली कॉपी सेव करता है और सबसे नई {0} रखता है।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex fa54d75c3..58145b0c1 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1796,4 +1796,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Az izmaid eltűntként jelentettek. Jelentkezz: {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'Ez a cím válaszol, de nem openGym-szerver. Ellenőrizd az URL-t.','Switch sides': 'Oldalcsere',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Minden befejezett edzés vagy rutinmódosítás után dátumozott másolatot ment ide: „{0}”, és a legújabb {1} darabot megtartja.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Minden befejezett edzés vagy rutinmódosítás után dátumozott másolatot ment a választott mappába, és a legújabb {0} darabot megtartja.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 2b7e3f4cc..16c3d84bf 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'I tuoi muscoli hanno denunciato la tua scomparsa. Presentati a {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'Quell’indirizzo risponde, ma non è un server openGym. Controlla l’URL.','Switch sides': 'Cambia lato',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Salva una copia datata in “{0}” dopo ogni allenamento finito o routine modificata, e tiene le {1} più recenti.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Salva una copia datata nella cartella che hai scelto dopo ogni allenamento finito o routine modificata, e tiene le {0} più recenti.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex cea165f2a..3d770b8d1 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': '근육들이 실종 신고를 냈다. {0}에 출석하라!','That address answers, but it isn’t an openGym server. Check the URL.': '이 주소는 응답하지만 openGym 서버가 아닙니다. URL을 확인하세요.','Switch sides': '방향 바꾸기',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': '운동을 마치거나 루틴을 수정할 때마다 “{0}”에 날짜가 붙은 사본을 저장하고 최신 {1}개를 보관합니다.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': '운동을 마치거나 루틴을 수정할 때마다 선택한 폴더에 날짜가 붙은 사본을 저장하고 최신 {0}개를 보관합니다.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 0ef55d851..9b7b8a9c9 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Twoje mięśnie zgłosiły twoje zaginięcie. Stawić się na „{0}”!','That address answers, but it isn’t an openGym server. Check the URL.': 'Ten adres odpowiada, ale to nie jest serwer openGym. Sprawdź URL.','Switch sides': 'Zmień stronę',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Zapisuje kopię z datą w „{0}” po każdym zakończonym treningu lub edycji planu i trzyma {1} najnowszych.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Zapisuje kopię z datą w wybranym folderze po każdym zakończonym treningu lub edycji planu i trzyma {0} najnowszych.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 2c64f6d35..f6262c866 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1114,6 +1114,8 @@ export const PT_BR_OVERRIDES = {'{1} animated exercises + {0} of your own': '{1} exercícios animados + {0} seus','That address answers, but it isn’t an openGym server. Check the URL.': 'Esse endereço responde, mas não é um servidor openGym. Verifique a URL.','Switch sides': 'Troque de lado',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Salva uma cópia datada em “{0}” depois de terminar um treino ou editar uma rotina, e mantém as {1} mais recentes.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Salva uma cópia datada na pasta que você escolheu depois de terminar um treino ou editar uma rotina, e mantém as {0} mais recentes.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 9684a4136..52598e95e 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Os teus músculos deram-te como desaparecido. Apresenta-te para {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'Esse endereço responde, mas não é um servidor openGym. Verifica o URL.','Switch sides': 'Troca de lado',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Guarda uma cópia datada em «{0}» depois de terminares um treino ou editares uma rotina, e mantém as {1} mais recentes.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Guarda uma cópia datada na pasta que escolheste depois de terminares um treino ou editares uma rotina, e mantém as {0} mais recentes.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex d58cbf485..7b9a83412 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1797,4 +1797,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Ваши мышцы подали заявление о пропаже. Явиться на «{0}»!','That address answers, but it isn’t an openGym server. Check the URL.': 'По этому адресу что-то отвечает, но это не сервер openGym. Проверьте URL.','Switch sides': 'Смените сторону',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Сохраняет копию с датой в «{0}» после каждой тренировки или правки программы и хранит {1} последних.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Сохраняет копию с датой в выбранную папку после каждой тренировки или правки программы и хранит {0} последних.',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex cb23c921c..1235ccc9c 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1804,4 +1804,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'กล้ามเนื้อของคุณแจ้งคนหายแล้ว มารายงานตัวที่ {0}!','That address answers, but it isn’t an openGym server. Check the URL.': 'ที่อยู่นี้ตอบกลับ แต่ไม่ใช่เซิร์ฟเวอร์ openGym ตรวจสอบ URL อีกครั้ง','Switch sides': 'สลับข้าง',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'บันทึกสำเนาพร้อมวันที่ไว้ใน “{0}” ทุกครั้งที่จบการออกกำลังกายหรือแก้รูทีน และเก็บไว้ {1} ชุดล่าสุด',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'บันทึกสำเนาพร้อมวันที่ไว้ในโฟลเดอร์ที่คุณเลือกทุกครั้งที่จบการออกกำลังกายหรือแก้รูทีน และเก็บไว้ {0} ชุดล่าสุด',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 65742c1e6..ac10b2b0b 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Kasların kayıp ilanı verdi. {0} için içtimaya gel!','That address answers, but it isn’t an openGym server. Check the URL.': 'Bu adres yanıt veriyor ama bir openGym sunucusu değil. URL’yi kontrol et.','Switch sides': 'Taraf değiştir',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Her antrenman bitince veya rutin düzenlenince «{0}» klasörüne tarihli bir kopya kaydeder ve en yeni {1} kopyayı tutar.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Her antrenman bitince veya rutin düzenlenince seçtiğin klasöre tarihli bir kopya kaydeder ve en yeni {0} kopyayı tutar.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex 5a1971fd1..f732a7c80 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -1790,4 +1790,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': 'Твої м’язи заявили про твоє зникнення. З’явитися на «{0}»!','That address answers, but it isn’t an openGym server. Check the URL.': 'Ця адреса відповідає, але це не сервер openGym. Перевір URL.','Switch sides': 'Зміни сторону',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': 'Зберігає копію з датою в «{0}» після кожного тренування чи зміни програми й тримає {1} найновіших.',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': 'Зберігає копію з датою у вибрану теку після кожного тренування чи зміни програми й тримає {0} найновіших.',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex fba63b373..9c4e0398c 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -1786,4 +1786,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': '你的肌肉已經報案協尋你了。馬上來練 {0}!','That address answers, but it isn’t an openGym server. Check the URL.': '這個位址有回應,但不是 openGym 伺服器。請檢查網址。','Switch sides': '換邊',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': '每次完成訓練或修改課表後,在「{0}」中儲存一份附日期的副本,並保留最新的 {1} 份。',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': '每次完成訓練或修改課表後,在你選擇的資料夾中儲存一份附日期的副本,並保留最新的 {0} 份。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 370bfef62..e5b84b60c 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1793,4 +1793,6 @@ export default {'Your muscles filed a missing-person report. Show up for {0}!': '你的肌肉已经报了失踪。马上来练{0}!','That address answers, but it isn’t an openGym server. Check the URL.': '该地址有响应,但不是 openGym 服务器。请检查网址。','Switch sides': '换边',+ 'Saves a dated copy to “{0}” after finishing a workout or editing a routine, and keeps the newest {1}.': '每次完成训练或修改计划后,在“{0}”中保存一份带日期的副本,并保留最新的 {1} 份。',+ 'Saves a dated copy to the folder you chose after finishing a workout or editing a routine, and keeps the newest {0}.': '每次完成训练或修改计划后,在你选择的文件夹中保存一份带日期的副本,并保留最新的 {0} 份。',}diff --git a/frontend/src/views/Settings.backupfolder.test.jsx b/frontend/src/views/Settings.backupfolder.test.jsxindex 3f414a771..115124e4c 100644--- a/frontend/src/views/Settings.backupfolder.test.jsx+++ b/frontend/src/views/Settings.backupfolder.test.jsx@@ -9,7 +9,7 @@ import { bindUI } from '../components/ui.jsx'globalThis.IS_REACT_ACT_ENVIRONMENT = trueconst mocks = vi.hoisted(() => {- const state = { S: null, MOBILE: true, android: true }+ const state = { S: null, MOBILE: true, android: true, folder: {}, asked: [] }state.snapshot = () => ({S: state.S,user: null,@@ -41,7 +41,14 @@ vi.mock('../lib/api.js', () => ({vi.mock('../lib/push.js', () => ({ pushSupported: () => false, enablePush: vi.fn(), disablePush: vi.fn(), sendTestPush: vi.fn() }))vi.mock('../lib/wakelock.js', () => ({ wakeLockSupported: () => false }))vi.mock('../lib/mobile.js', () => ({ get MOBILE() { return mocks.MOBILE }, isAndroid: () => Promise.resolve(mocks.android), shareExport: vi.fn(), syncReminder: vi.fn() }))-vi.mock('../components/BackupFolderRow.jsx', () => ({ default: () => <div className="backup-folder-row" /> }))+vi.mock('../components/BackupFolderRow.jsx', async () => {+ const real = await vi.importActual('../components/BackupFolderRow.jsx')+ return {+ default: () => <div className="backup-folder-row" />,+ useBackupFolder: enabled => { mocks.asked.push(enabled); return [enabled ? mocks.folder : null, () => {}] },+ autoBackupSubtitle: real.autoBackupSubtitle,+ }+})vi.mock('../lib/update.js', () => ({ checkForUpdate: () => new Promise(() => {}), downloadAndInstall: vi.fn() }))vi.mock('./MobileOnboarding.jsx', () => ({ ConnectSheet: () => null }))vi.mock('../sheets.jsx', () => ({@@ -65,6 +72,8 @@ beforeEach(() => {}mocks.MOBILE = truemocks.android = true+ mocks.folder = {}+ mocks.asked = []host = document.createElement('div')document.body.appendChild(host)root = createRoot(host)@@ -95,3 +104,20 @@ describe('the backup folder rows', () => {expect(shown()).toBe(false)})})++// Android QA: the Auto-backup row still said Documents/openGym after another folder was chosen.+describe('the Auto-backup row', () => {+ const subtitle = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Auto-backup on changes'))?.querySelector('.lrow-s')?.textContent+ it('names the chosen folder', async () => {+ mocks.S.autoBackup = true+ mocks.folder = { uri: 'content://tree/Sync', label: 'SyncFolder' }+ await mount()+ expect(subtitle()).toContain('“SyncFolder”')+ expect(subtitle()).not.toContain('Documents/openGym')+ })+ it('names Documents/openGym with no folder chosen', async () => {+ mocks.S.autoBackup = true+ await mount()+ expect(subtitle()).toContain('Documents/openGym')+ })+})diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 02a9d7213..c5efa904f 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -29,7 +29,7 @@ import { checkForUpdate, downloadAndInstall } from '../lib/update.js'import { forgetCoach } from '../lib/coach-api.js'import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet } from '../sheets.jsx'import Icon from '../components/Icon.jsx'-import BackupFolderRow from '../components/BackupFolderRow.jsx'+import BackupFolderRow, { useBackupFolder, autoBackupSubtitle } from '../components/BackupFolderRow.jsx'import { ServerSyncSection, KeptChangesRows, leaveServer, connectServer, passkeySignIn } from '../components/ServerSync.jsx'import { passwordOn, PasswordRow, openPasswordSignIn, openPasswordRegister } from '../components/PasswordAuth.jsx'import { usePasskeys, PasskeysRow, DeviceLinkRow } from '../components/Passkeys.jsx'@@ -106,6 +106,8 @@ export default function Settings() {const [updateInfo, setUpdateInfo] = useState(null) // { hasUpdate, latestVersion, apkUrl, hashUrl } | nullconst [android, setAndroid] = useState(false)const [checking, setChecking] = useState(false)+ // Where auto-backup writes on this Android phone, for the Auto-backup row's own subtitle.+ const [backupDir] = useBackupFolder(MOBILE && android && !!S.autoBackup)useEffect(() => {// The in-app updater installs an .apk, so it only applies to the native Android build.@@ -625,7 +627,7 @@ export default function Settings() {{/* 14 is AUTO_BACKUP_KEEP in lib/mobile.js, written out because the Settings tests mockthat module wholesale; mobile.autobackup.test.js pins the two together. */}{MOBILE && <Row icon="history" iconTint="var(--blue)" title={t('Auto-backup on changes')}- subtitle={t('Saves a dated copy to Documents/openGym after finishing a workout or editing a routine, and keeps the newest {0}. Point a sync app at that folder, or copy it out by hand.', 14)}>+ subtitle={autoBackupSubtitle(android && S.autoBackup ? backupDir : null, 14)}><Switch checked={!!S.autoBackup} onChange={v => update(s => { s.autoBackup = v })} /></Row>}{/* Android only: the system folder picker (#161). iOS shows Documents in Files already. */}