From 1c97ffb91bb4928022e995709d7e55b19cfd18eb Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 10 Oct 2026 15:50:39 +0200 Subject: 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 /-drive. Co-Authored-By: Claude Opus 5.5 --- .../src/meshbay_hub/static/drive-sync.js | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js (limited to 'packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js b/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js new file mode 100644 index 0000000..5ddf188 --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/static/drive-sync.js @@ -0,0 +1,29 @@ +// Files backup: the folders the person chose through the system's picker, +// sent into `/-drive//…` of the destination +// every backup shares (sync-destination.js), once a day, on an unmetered +// network, like photos (docs/MESHBAY_DESIGN.md §9.13). +// +// The phone (platform.driveSync) lists the files, leaves out what the photo +// backup sends, keeps the ledger and hands each file over a range at a time; +// the running is the photo backup's own (createBackup). Additive by +// construction: a new version of a file goes beside the one sent, and nothing +// here deletes, renames or replaces anything on the node. + +import * as platform from './platform.js'; +import { t } from './i18n.js'; +import { createBackup } from './photo-sync.js'; +import { LASTING, failureText } from './phone-sync.js'; + +const drive = createBackup({ + name: 'files', + sync: platform.driveSync, + configured: (status) => Boolean(status.on) && (status.folders || []).length > 0, + progress: 'drivesync.notif_progress', + failures: LASTING, + say: (code) => t('phonesync.notice', { what: t('drivesync.heading'), reason: failureText(code) }), +}); + +export const startDriveSync = (context) => drive.start(context); +export const stopDriveSync = () => drive.stop(); +export const runDriveSync = (opts) => drive.run(opts); +export const subscribe = (fn) => drive.subscribe(fn); -- cgit v1.2.3