@lifeaitools/clauth 1.4.9 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/serve.js +25 -2
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -2362,6 +2362,22 @@ async function updateBuildStatus() {
|
|
|
2362
2362
|
}
|
|
2363
2363
|
setInterval(updateBuildStatus, 10000);
|
|
2364
2364
|
|
|
2365
|
+
// Detect daemon restart (PID change) and reload so boot() runs fresh.
|
|
2366
|
+
// Without this, an old tab stays in main-view after restart, sees tunnel
|
|
2367
|
+
// as not_started (vault locked), and gets stuck showing "checking tunnel".
|
|
2368
|
+
let _watchedPid = null;
|
|
2369
|
+
setInterval(async () => {
|
|
2370
|
+
try {
|
|
2371
|
+
const p = await fetch(BASE + "/ping").then(r => r.json());
|
|
2372
|
+
if (_watchedPid && p.pid !== _watchedPid) { window.location.reload(); return; }
|
|
2373
|
+
_watchedPid = p.pid;
|
|
2374
|
+
// Also recover if vault became locked on us (e.g. user locked from another tab)
|
|
2375
|
+
if (p.locked && document.getElementById("main-view").style.display !== "none") {
|
|
2376
|
+
window.location.reload();
|
|
2377
|
+
}
|
|
2378
|
+
} catch {}
|
|
2379
|
+
}, 5000);
|
|
2380
|
+
|
|
2365
2381
|
boot();
|
|
2366
2382
|
</script>
|
|
2367
2383
|
</body>
|
|
@@ -2465,7 +2481,11 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
2465
2481
|
}
|
|
2466
2482
|
|
|
2467
2483
|
async function startTunnel() {
|
|
2468
|
-
if (tunnelProc)
|
|
2484
|
+
if (tunnelProc) {
|
|
2485
|
+
// Already running — ensure status reflects reality (caller may have reset it to "starting")
|
|
2486
|
+
tunnelStatus = "live";
|
|
2487
|
+
return;
|
|
2488
|
+
}
|
|
2469
2489
|
tunnelUrl = null;
|
|
2470
2490
|
tunnelError = null;
|
|
2471
2491
|
|
|
@@ -3433,7 +3453,10 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3433
3453
|
try {
|
|
3434
3454
|
const pwEscaped = pw.replace(/'/g, "''");
|
|
3435
3455
|
const psExpr = `[Convert]::ToBase64String([Security.Cryptography.ProtectedData]::Protect([Text.Encoding]::UTF8.GetBytes('${pwEscaped}'),$null,'CurrentUser'))`;
|
|
3436
|
-
const
|
|
3456
|
+
const psExe = process.env.SystemRoot
|
|
3457
|
+
? `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
|
|
3458
|
+
: "powershell.exe";
|
|
3459
|
+
const encrypted = execSyncTop(`"${psExe}" -NoProfile -Command "${psExpr}"`, { encoding: "utf8", timeout: 5000 }).trim();
|
|
3437
3460
|
fs.writeFileSync(bootKeyPath, encrypted, "utf8");
|
|
3438
3461
|
const sealLog = `[${new Date().toISOString()}] Auto-sealed boot.key via DPAPI (crash recovery enabled)\n`;
|
|
3439
3462
|
try { fs.appendFileSync(LOG_FILE, sealLog); } catch {}
|