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
Mobile: Android's cloud backup leaves the photo and video folder out, and iOS asks for the camera and microphone for a video of an exercise
Duarte Santos6f9d3f580f7b
diff --git a/frontend/android/app/src/main/AndroidManifest.xml b/frontend/android/app/src/main/AndroidManifest.xmlindex 4774773f0..4a7aeddbe 100644--- a/frontend/android/app/src/main/AndroidManifest.xml+++ b/frontend/android/app/src/main/AndroidManifest.xml@@ -2,6 +2,8 @@<manifest xmlns:android="http://schemas.android.com/apk/res/android"><applicationandroid:allowBackup="true"+ android:fullBackupContent="@xml/backup_rules"+ android:dataExtractionRules="@xml/data_extraction_rules"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"diff --git a/frontend/android/app/src/main/res/xml/backup_rules.xml b/frontend/android/app/src/main/res/xml/backup_rules.xmlnew file mode 100644index 000000000..3354925d9--- /dev/null+++ b/frontend/android/app/src/main/res/xml/backup_rules.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Android Auto Backup up to Android 11 (API 30): what the cloud backup takes of the app.+ Everything, as before, except the local copies of the photos and videos of custom exercises+ (src/lib/media-store-fs.js, Directory.Library, which is the files directory). Auto Backup+ skips an app's WHOLE backup once it passes 25 MB, and a few videos would take the state+ mirror (opengym-state.json) down with them. A paired phone gets the files back from its+ server; a phone in local mode keeps them in the zip export. -->+<full-backup-content>+ <exclude domain="file" path="opengym-media/" />+</full-backup-content>diff --git a/frontend/android/app/src/main/res/xml/data_extraction_rules.xml b/frontend/android/app/src/main/res/xml/data_extraction_rules.xmlnew file mode 100644index 000000000..95b0f44ae--- /dev/null+++ b/frontend/android/app/src/main/res/xml/data_extraction_rules.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Android 12 (API 31) and later: the same rule as backup_rules.xml for the cloud backup, where+ the 25 MB cap applies. A device-to-device transfer has no such cap, and a phone moved to a+ new one should arrive with its photos and videos, so that section is left out: without one,+ a transfer takes everything, as before. -->+<data-extraction-rules>+ <cloud-backup>+ <exclude domain="file" path="opengym-media/" />+ </cloud-backup>+</data-extraction-rules>diff --git a/frontend/ios/App/App/Info.plist b/frontend/ios/App/App/Info.plistindex c06987bdd..59a4aed57 100644--- a/frontend/ios/App/App/Info.plist+++ b/frontend/ios/App/App/Info.plist@@ -63,6 +63,8 @@<key>UIViewControllerBasedStatusBarAppearance</key><true/><key>NSCameraUsageDescription</key>- <string>Used to scan your gym membership QR code so you can check in from the app.</string>+ <string>Used to scan your gym membership QR code, and to take a photo or video of an exercise you add yourself.</string>+ <key>NSMicrophoneUsageDescription</key>+ <string>Used to record the sound of a video you take of an exercise you add yourself.</string></dict></plist>diff --git a/frontend/src/lib/android-backup.test.js b/frontend/src/lib/android-backup.test.jsnew file mode 100644index 000000000..7a5118b89--- /dev/null+++ b/frontend/src/lib/android-backup.test.js@@ -0,0 +1,39 @@+// Android's cloud backup (Auto Backup) skips an app's whole backup once it passes 25 MB. The+// 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.+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'++const read = p => readFileSync(new URL('../../android/app/src/main/' + p, import.meta.url), 'utf8')+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*\/>/++describe('Android backup rules', () => {+ it('the manifest names both rule files', () => {+ expect(manifest).toMatch(/android:fullBackupContent="@xml\/backup_rules"/)+ expect(manifest).toMatch(/android:dataExtractionRules="@xml\/data_extraction_rules"/)+ expect(manifest).toMatch(/android:allowBackup="true"/)+ })++ it('both leave the media folder out of the cloud backup, and only that', () => {+ 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] || ''+ expect(cloud).toMatch(EXCLUDE)+ // 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/)+ })++ it('no comment carries a double dash, which breaks the Android build (v1.3.6)', () => {+ for (const xml of [legacy, modern, manifest]) {+ for (const c of xml.match(/<!--([\s\S]*?)-->/g) || []) expect(c.slice(4, -3)).not.toContain('--')+ }+ })+})