feat(storage): add offline SQLite mode
This commit is contained in:
1 parent
0a68782172
commit
ada528ed7b
13 files changed
+299
-21
No files matched your search
@@ -65,7 +65,10 @@ assert.doesNotMatch(assets.indexHtml, /setTimeout\(applyLanguage\s*,/);
|
||||
assert.doesNotMatch(assets.addonsJs, /(?<![\w.])applyLanguage\s*\(/, "add-on actions must not call a missing global locale function");
|
||||
assert.match(assets.indexHtml, /window\.renderIcons=renderIcons;window\.renderAll=renderAll/, "shared renderers are explicitly exposed to locale scripts");
|
||||
const shippedScripts = [...assets.indexHtml.matchAll(/<script>([\s\S]*?)<\/script>/g)].map(match => match[1]);
|
||||
assert.equal(shippedScripts.length, 26, "the complete desktop script chain is present in the served HTML");
|
||||
assert.equal(shippedScripts.length, 27, "the complete desktop script chain is present in the served HTML");
|
||||
assert.match(assets.indexHtml, /LifeOSLocalDB/);
|
||||
assert.match(assets.indexHtml, /OPFS:\/lifeos\.sqlite/);
|
||||
assert.match(assets.serviceWorker, /sqlite3\.wasm/);
|
||||
assert.doesNotMatch(assets.indexHtml, /<script\s+src=/, "the desktop cannot silently fall back when an app script fails to load");
|
||||
assert.ok(assets.indexHtml.indexOf('window.systemApp =') < assets.indexHtml.lastIndexOf("window.init()"), "locale renderers run before desktop initialization");
|
||||
for (const script of shippedScripts) new vm.Script(script);
|
||||
@@ -269,7 +272,7 @@ assert.ok(command('date').message.length > 8);
|
||||
assert.ok(command('time').message.includes(':'));
|
||||
assert.ok(command('datetime').message.length > 12);
|
||||
assert.equal(command('uptime').message, 'terminal.uptime');
|
||||
assert.equal(command('version').message, 'Life OS v1.18.1');
|
||||
assert.equal(command('version').message, 'Life OS v1.19.0');
|
||||
assert.equal(command('status').message, 'terminal.status');
|
||||
assert.match(command('apps').message, /calendar/);
|
||||
assert.equal(command('echo "hello Life OS"').message, 'hello Life OS');
|
||||
@@ -373,7 +376,7 @@ const uiContext = vm.createContext({
|
||||
...Object.fromEntries(["icons", "tasks", "launcher", "calendar", "desktop", "boot", "modal"].map(id => [id, uiNodes.get(`#${id}`)]))
|
||||
});
|
||||
uiContext.window = uiContext;
|
||||
for (const index of [0, ...Array.from({ length: 10 }, (_, i) => i + 2), 12, 13, 18, 19]) vm.runInContext(shippedScripts[index], uiContext);
|
||||
for (const index of [0, ...Array.from({ length: 10 }, (_, i) => i + 3), 13, 14, 19, 20]) vm.runInContext(shippedScripts[index], uiContext);
|
||||
vm.runInContext("windows.system={classList:{contains(){return false}}}", uiContext);
|
||||
uiContext.setLanguage("zh");
|
||||
assert.equal(uiContext.LifeI18n.language(), "zh-CN");
|
||||
|
||||
Reference in new issue
Block a user