Load layouts and optional features from staged asset caches

This commit is contained in:
Jonathan Sykes
2026-10-08 01:29:50 +08:00
parent d98d444552
commit 5d6a1545df
30 changed files with 512 additions and 146 deletions

View File

@@ -34,8 +34,7 @@
// Incremental SHA-256 (frontend/sha256.js): the file is hashed while it is
// written, so the device knows its content id without re-reading the file.
try { importScripts('/sha256.js'); } catch { /* hashing unavailable — save still works */ }
importScripts('/resume-core.js');
async function getVideosDir() {
const root = await navigator.storage.getDirectory();
@@ -203,6 +202,10 @@ async function writeFile(dirName, name, buffer) {
}
self.onmessage = async (e) => {
self.__ASSET_URLS__=e.data?.assetUrls || {};
try { if(!self.Sha256)importScripts(self.__ASSET_URLS__.sha256 || '/sha256.js'); } catch { /* hashing unavailable — legacy save still works */ }
try { if(!self.ResumeCore)importScripts(self.__ASSET_URLS__.resume || '/resume-core.js'); }
catch(error) { self.postMessage({type:'error',error:error.message}); return; }
if (e.data && e.data.op === 'write') {
try { await writeFile(e.data.dir, e.data.name, e.data.buffer); self.postMessage({ type: 'written' }); }
catch (err) { self.postMessage({ type: 'error', error: err && err.message ? err.message : String(err) }); }