feat(storage): index local records and expand global search
This commit is contained in:
1 parent
f31d3933ae
commit
3877d4f986
23 files changed
+184
-62
No files matched your search
+1
-1
@@ -13,7 +13,7 @@ const [rawIndexHtml, addonsJs, backupJs, bootGuardJs, localDbJs, localDbWorkerJs
|
||||
readFile(new URL("../node_modules/@sqlite.org/sqlite-wasm/dist/sqlite3.wasm", import.meta.url)),
|
||||
text("i18n.js"), text("tasks.js"), text("calendar.js"), text("notifications.js"), text("i18n-renderers.js"), text("desktop-personalization.js"), text("desktop-widgets.js"), text("system-navigation.js"), text("browser-app.js"), text("data-actions.js"), text("terminal-app.js"), text("db-admin.js"), text("manifest.webmanifest"), text("service-worker.js"), text("life-os-icon.svg"), readFile(new URL("../public/locales/en.json", import.meta.url), "utf8"), readFile(new URL("../public/locales/zh-CN.json", import.meta.url), "utf8")
|
||||
]);
|
||||
const release = "1.21.0";
|
||||
const release = "1.22.0";
|
||||
const localeEnJs = `window.LifeOSLocales=window.LifeOSLocales||{};window.LifeOSLocales.en=${localeEn};`;
|
||||
const localeZhJs = `window.LifeOSLocales=window.LifeOSLocales||{};window.LifeOSLocales['zh-CN']=${localeZh};`;
|
||||
const extraLocaleCodes = ['zh-HK', 'zh-MO', 'zh-TW', 'ar', 'fr', 'ru', 'es', 'ja'];
|
||||
|
||||
@@ -4,6 +4,7 @@ import vm from "node:vm";
|
||||
const worker = await import(new URL("../dist/server/index.js", import.meta.url));
|
||||
assert.equal(typeof worker.default?.fetch, "function");
|
||||
const assets = await import(new URL("../dist/server/assets.js", import.meta.url));
|
||||
const localAssets = await import(new URL("../dist/server/local-assets.js", import.meta.url));
|
||||
const source = await readFile(new URL("../public/index.html", import.meta.url), "utf8");
|
||||
assert.match(assets.indexHtml, /!\[1,2,3\]\.includes\(d\.schemaVersion\)/);
|
||||
assert.doesNotMatch(assets.indexHtml, /localizeDynamicText|createTreeWalker|NodeFilter\.SHOW_TEXT|const ZH=/);
|
||||
@@ -22,6 +23,10 @@ assert.match(assets.addonsJs, /lifeos_sync_outbox_v1/);
|
||||
assert.match(assets.addonsJs, /function openSyncCenter/);
|
||||
assert.match(assets.addonsJs, /resolveSavedConflict/);
|
||||
assert.match(assets.serviceWorker, /SKIP_WAITING/);
|
||||
assert.match(localAssets.localDbWorkerJs, /CREATE TABLE IF NOT EXISTS memories/);
|
||||
assert.match(localAssets.localDbWorkerJs, /CREATE INDEX IF NOT EXISTS idx_tasks_due_done/);
|
||||
assert.match(localAssets.localDbWorkerJs, /action === 'search'/);
|
||||
assert.match(assets.indexHtml, /LifeOSLocalDB\.search/);
|
||||
assert.match(assets.i18nRenderersJs, /dialog\.goals/);
|
||||
assert.match(assets.i18nRenderersJs, /shell\.wallpaperTitle/);
|
||||
assert.match(assets.i18nRenderersJs, /window\.museumApp/);
|
||||
@@ -279,7 +284,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.21.0');
|
||||
assert.equal(command('version').message, 'Life OS v1.22.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');
|
||||
@@ -302,7 +307,7 @@ const makeStorage = initial => {
|
||||
};
|
||||
const backupStorage = makeStorage({
|
||||
lifeos_memories: '[]', lifeos_museum: '[]', lifeos_profile: '{}', lifeos_settings: '{}', lifeos_system: '{"schemaVersion":2}',
|
||||
lifeos_notifications_v1: '{"memory":{"enabled":true}}', lifeos_storage_mode_v1: 'local', lifeos_cloud_baseline_v3: '{"internal":true}'
|
||||
lifeos_notifications_v1: '{"memory":{"enabled":true}}', lifeos_storage_mode_v1: 'local', lifeos_cloud_baseline_v3: '{"internal":true}', lifeos_sync_outbox_v1: '[{"kind":"memory"}]'
|
||||
});
|
||||
Object.defineProperties(backupStorage, { length: { get: () => backupStorage.values.size } });
|
||||
backupStorage.key = index => [...backupStorage.values.keys()][index] ?? null;
|
||||
@@ -320,6 +325,7 @@ assert.equal(portableBackup.schemaVersion, 3);
|
||||
assert.equal(portableBackup.records.lifeos_notifications_v1, '{"memory":{"enabled":true}}');
|
||||
assert.equal(portableBackup.records.lifeos_storage_mode_v1, undefined, 'device storage choice does not migrate');
|
||||
assert.equal(portableBackup.records.lifeos_cloud_baseline_v3, undefined, 'cloud internals do not migrate');
|
||||
assert.equal(portableBackup.records.lifeos_sync_outbox_v1, undefined, 'sync queue does not migrate');
|
||||
assert.equal(await backupContext.LifeOSBackup.validate(portableBackup), true);
|
||||
portableBackup.records.lifeos_notifications_v1 = '{}';
|
||||
assert.equal(await backupContext.LifeOSBackup.validate(portableBackup), false, 'checksum rejects a modified backup');
|
||||
|
||||
Reference in new issue
Block a user