fix(database): use per-user admin passwords

This commit is contained in:
Codex committed 2026-09-28 19:03:19 +08:00
1 parent 33e80a566e
commit 9862348d70
17 files changed
+188 -38

No files matched your search

+5 -2
View File
@@ -58,12 +58,15 @@ for (const script of [assets.i18nJs, assets.dataActionsJs, assets.terminalAppJs,
const adminNode = { innerHTML: "", querySelector: () => ({ addEventListener() {} }) };
const adminContext = vm.createContext({
document: { createElement: () => ({ textContent: "" }), head: { append() {} }, querySelector: () => adminNode },
LifeI18n: { t: key => key }, window: {}, Date
LifeI18n: { t: key => key }, window: {}, Date,
fetch: async () => ({ ok: true, status: 200, json: async () => ({ configured: false }) })
});
vm.runInContext(assets.dbAdminJs, adminContext);
adminContext.window.databaseApp(adminNode);
await new Promise(resolve => setTimeout(resolve, 0));
assert.match(adminNode.innerHTML, /lifeos-admin/);
assert.match(adminNode.innerHTML, /type="password"/);
assert.match(adminNode.innerHTML, /confirmPassword/);
assert.match(adminNode.innerHTML, /name="acknowledged" required/);
const browserNodes = Object.fromEntries(['.browser-toolbar', '.browser-address', 'iframe', '[data-action="back"]', '[data-action="forward"]', '.browser-external', '.browser-hint-link'].map(key => [key, { value: '', href: '', disabled: false, listeners: {}, addEventListener(type, handler) { this.listeners[type] = handler; }, getAttribute(name) { return this[name] ?? null; } }]));
const browserContainer = { dataset: {}, innerHTML: '', querySelector(selector) { return selector === '.browser-shell' ? (this.innerHTML ? {} : null) : browserNodes[selector]; } };
@@ -183,7 +186,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.14.0');
assert.equal(command('version').message, 'Life OS v1.14.1');
assert.equal(command('status').message, 'terminal.status');
assert.match(command('apps').message, /calendar/);
assert.equal(command('echo "hello Life OS"').message, 'hello Life OS');