PWA: install button, one icon badge for Signal, mail and tasks due, share target for files, manifest launch handler
build-container / build (push) Successful in 22m24s
build-container / build (push) Successful in 22m24s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c5a7b5155
commit
924a024b0b
9 files changed
+88
-6
No files matched your search
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
// Files shared into NE Hub from other apps (the manifest's share target; sw.js keeps them): choose a Seafile folder, then upload.
|
||||
async function shareCheck() {
|
||||
if (!('caches' in window)) return;
|
||||
let c, keys;
|
||||
try { c = await caches.open('hub-share'); keys = await c.keys(); } catch { return; }
|
||||
if (!keys.length) return;
|
||||
const clear = async () => { for (const k of await c.keys()) await c.delete(k); };
|
||||
if (!allowed('files')) { await clear(); toast('You do not have the Files tab, so shared files were discarded'); return; }
|
||||
const files = [];
|
||||
for (const k of keys) { const r = await c.match(k); if (r) files.push(new File([await r.blob()], decodeURIComponent(r.headers.get('x-name') || 'file'), { type: r.headers.get('content-type') || '' })); }
|
||||
const loc = store.get('office_loc');
|
||||
const dst = await chooseFolder('Save ' + (files.length === 1 ? '“' + files[0].name + '”' : files.length + ' shared files') + ' to…', loc ? { repo: loc.repo, repoName: loc.repoName || '', dir: loc.dir } : null, { okLabel: 'Upload here', newFolder: true });
|
||||
await clear();
|
||||
if (!dst) return toast('Shared files discarded');
|
||||
enqueueUploads(dst.repo, dst.dir, files.map(file => ({ file })));
|
||||
}
|
||||
Reference in new issue
Block a user