diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/platform.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/platform.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/platform.js b/packages/meshbay-hub/src/meshbay_hub/static/platform.js index 596c327..47e3a72 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/platform.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/platform.js @@ -255,15 +255,17 @@ export const photoSync = { /** * A file the phone issued under `token`, as what an upload reads (`name`, * `size`, `slice(a, b).arrayBuffer()`): each slice is fetched from the phone - * when it is read, so a video of gigabytes is never whole in this page. + * when it is read, so a video of gigabytes is never whole in this page. The + * slice is in the address (`?range=a-b`), not a Range header: the WebView + * does not hand that header to the application that answers. */ function rangedFile(prefix, token, name, size) { const url = `${prefix}${encodeURIComponent(token)}`; const part = (start, end) => ({ async arrayBuffer() { if (end <= start) return new ArrayBuffer(0); - const r = await fetch(url, { cache: 'no-store', headers: { Range: `bytes=${start}-${end - 1}` } }); - if (r.status !== 206) throw new Error('This file is no longer on the phone'); + const r = await fetch(`${url}?range=${start}-${end - 1}`, { cache: 'no-store' }); + if (!r.ok) throw new Error('This file is no longer on the phone'); return r.arrayBuffer(); }, }); @@ -343,6 +345,7 @@ function docSync(name) { sent(token, dir, n) { return b.sent(token, dir, n); }, completed() { return b.completed(); }, failed(code, text) { return b.failed(code, text); }, + openSettings() { return b.openSettings(); }, /** The file the last plan wrote, as a File named for the node. */ async file(token, fileName) { const r = await fetch(`/phonesync/${encodeURIComponent(token)}`, { cache: 'no-store' }); |