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
Android backup test: the pairing token stays out, device transfer takes the rest
Duarte Santosb9490fa9ffcb
diff --git a/frontend/src/lib/android-backup.test.js b/frontend/src/lib/android-backup.test.jsindex 7a5118b89..3681e068f 100644--- a/frontend/src/lib/android-backup.test.js+++ b/frontend/src/lib/android-backup.test.js@@ -2,7 +2,8 @@// local copies of the photos and videos of custom exercises (lib/media-store-fs.js, the files// directory's opengym-media/) would take the state mirror down with them, so both rule files// leave that folder out of the cloud backup — and the manifest has to point at them, or neither-// applies. A device-to-device transfer keeps it.+// applies. A device-to-device transfer keeps it. The pairing (opengym-remote.json, the session+// token for the server) stays out of both: a backup is no place for a credential.import { describe, it, expect } from 'vitest'import { readFileSync } from 'node:fs'@@ -11,6 +12,7 @@ const manifest = read('AndroidManifest.xml')const legacy = read('res/xml/backup_rules.xml')const modern = read('res/xml/data_extraction_rules.xml')const EXCLUDE = /<exclude\s+domain="file"\s+path="opengym-media\/"\s*\/>/+const TOKEN = /<exclude\s+domain="file"\s+path="opengym-remote\.json"\s*\/>/describe('Android backup rules', () => {it('the manifest names both rule files', () => {@@ -19,7 +21,7 @@ describe('Android backup rules', () => {expect(manifest).toMatch(/android:allowBackup="true"/)})- it('both leave the media folder out of the cloud backup, and only that', () => {+ it('both leave the media folder out of the cloud backup', () => {expect(legacy).toMatch(/<full-backup-content>[\s\S]*<\/full-backup-content>/)expect(legacy).toMatch(EXCLUDE)const cloud = modern.match(/<cloud-backup>([\s\S]*?)<\/cloud-backup>/)?.[1] || ''@@ -27,8 +29,16 @@ describe('Android backup rules', () => {// An <include> would turn either list into an allowlist and drop everything else.expect(legacy).not.toMatch(/<include/)expect(modern).not.toMatch(/<include/)- // Device transfer is left alone, so it takes everything.- expect(modern).not.toMatch(/<device-transfer/)+ // Device transfer takes everything but the pairing.+ const transfer = modern.match(/<device-transfer>([\s\S]*?)<\/device-transfer>/)?.[1] || ''+ expect(transfer).not.toMatch(EXCLUDE)+ expect(transfer.match(/<exclude/g)).toHaveLength(1)+ })++ it('the pairing token is left out of every backup and transfer', () => {+ expect(legacy).toMatch(TOKEN)+ expect(modern.match(/<cloud-backup>([\s\S]*?)<\/cloud-backup>/)?.[1]).toMatch(TOKEN)+ expect(modern.match(/<device-transfer>([\s\S]*?)<\/device-transfer>/)?.[1]).toMatch(TOKEN)})it('no comment carries a double dash, which breaks the Android build (v1.3.6)', () => {