mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
28 lines
804 B
JavaScript
28 lines
804 B
JavaScript
import { startNodewardenApp } from './app.js';
|
|
|
|
async function ensureQrLibrary() {
|
|
if (typeof window.qrcode === 'function') return;
|
|
await new Promise((resolve) => {
|
|
const s = document.createElement('script');
|
|
s.src = '/web/vendor/qrcode-generator.min.js';
|
|
s.async = true;
|
|
s.onload = () => resolve(null);
|
|
s.onerror = () => resolve(null);
|
|
document.head.appendChild(s);
|
|
});
|
|
}
|
|
|
|
async function loadRuntimeConfig() {
|
|
try {
|
|
const resp = await fetch('/api/web/config', { method: 'GET' });
|
|
if (!resp.ok) throw new Error('runtime config request failed');
|
|
return await resp.json();
|
|
} catch {
|
|
return { defaultKdfIterations: 600000 };
|
|
}
|
|
}
|
|
|
|
await ensureQrLibrary();
|
|
const cfg = await loadRuntimeConfig();
|
|
startNodewardenApp(cfg || { defaultKdfIterations: 600000 });
|