diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-10 15:50:39 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-10 15:50:39 +0200 |
| commit | 1c97ffb91bb4928022e995709d7e55b19cfd18eb (patch) | |
| tree | aaa05d17adcd6db4256c01ba79b27dfc7ec96d70 /packages/meshbay-hub/src/meshbay_hub/static/app.js | |
| parent | 1521cc1ac0cca7ee8786056f84fa399d5cc268f9 (diff) | |
| download | meshbay-1c97ffb91bb4928022e995709d7e55b19cfd18eb.tar.gz | |
feat(android): back up the files of folders the person chooses
A Files section takes folders through the system picker (no storage
permission), refuses DCIM, Pictures and Movies, skips what the photo backup
sends, and runs on the photo backup's own runner into <folder>/<account>-drive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/app.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/app.js | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/app.js b/packages/meshbay-hub/src/meshbay_hub/static/app.js index 031e276..d8818d0 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/app.js @@ -919,6 +919,19 @@ function App() { pullOnce(user.userId).catch(() => {}); }, [user, groups.length]); + // What every phone backup runs with: the live user and bundle key, read + // when a run starts, never ones captured here. + const backupContext = () => ({ + hub: HUB, + hubFetch, + getUser: () => userRef.current, + getBundleKey: async () => { + const key = session.bundleKey || await _loadBundleKey(); + if (key) session.bundleKey = key; + return key; + }, + }); + // Photo backup (docs/MESHBAY_DESIGN.md §9.12), on the Android application // only: loaded and started once signed in, stopped on sign-out. A run reads // the live user and bundle key when it starts, never ones captured here. @@ -929,21 +942,25 @@ function App() { let gone = false; import('./photo-sync.js').then((m) => { if (gone) return; - m.startPhotoSync({ - hub: HUB, - hubFetch, - getUser: () => userRef.current, - getBundleKey: async () => { - const key = session.bundleKey || await _loadBundleKey(); - if (key) session.bundleKey = key; - return key; - }, - }); + m.startPhotoSync(backupContext()); stop = m.stopPhotoSync; }).catch((e) => console.warn('[MeshBay] photo backup did not load:', e.message)); return () => { gone = true; if (stop) stop(); }; }, [syncAccount]); + // Files backup (§9.13), the same way. + useEffect(() => { + if (!syncAccount || !platform.driveSync.available) return undefined; + let stop = null; + let gone = false; + import('./drive-sync.js').then((m) => { + if (gone) return; + m.startDriveSync(backupContext()); + stop = m.stopDriveSync; + }).catch((e) => console.warn('[MeshBay] files backup did not load:', e.message)); + return () => { gone = true; if (stop) stop(); }; + }, [syncAccount]); + // Contacts, calendar and messages backup (§9.13), the same way. useEffect(() => { if (!syncAccount || !(platform.contactSync.available || platform.calendarSync.available @@ -954,16 +971,7 @@ function App() { let gone = false; import('./phone-sync.js').then((m) => { if (gone) return; - m.startPhoneSync({ - hub: HUB, - hubFetch, - getUser: () => userRef.current, - getBundleKey: async () => { - const key = session.bundleKey || await _loadBundleKey(); - if (key) session.bundleKey = key; - return key; - }, - }); + m.startPhoneSync(backupContext()); stop = m.stopPhoneSync; }).catch((e) => console.warn('[MeshBay] phone backups did not load:', e.message)); return () => { gone = true; if (stop) stop(); }; |