@lifeaitools/clauth 1.4.9 → 1.5.0
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 +9 -2
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -2465,7 +2465,11 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
2465
2465
|
}
|
|
2466
2466
|
|
|
2467
2467
|
async function startTunnel() {
|
|
2468
|
-
if (tunnelProc)
|
|
2468
|
+
if (tunnelProc) {
|
|
2469
|
+
// Already running — ensure status reflects reality (caller may have reset it to "starting")
|
|
2470
|
+
tunnelStatus = "live";
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2469
2473
|
tunnelUrl = null;
|
|
2470
2474
|
tunnelError = null;
|
|
2471
2475
|
|
|
@@ -3433,7 +3437,10 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3433
3437
|
try {
|
|
3434
3438
|
const pwEscaped = pw.replace(/'/g, "''");
|
|
3435
3439
|
const psExpr = `[Convert]::ToBase64String([Security.Cryptography.ProtectedData]::Protect([Text.Encoding]::UTF8.GetBytes('${pwEscaped}'),$null,'CurrentUser'))`;
|
|
3436
|
-
const
|
|
3440
|
+
const psExe = process.env.SystemRoot
|
|
3441
|
+
? `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
|
|
3442
|
+
: "powershell.exe";
|
|
3443
|
+
const encrypted = execSyncTop(`"${psExe}" -NoProfile -Command "${psExpr}"`, { encoding: "utf8", timeout: 5000 }).trim();
|
|
3437
3444
|
fs.writeFileSync(bootKeyPath, encrypted, "utf8");
|
|
3438
3445
|
const sealLog = `[${new Date().toISOString()}] Auto-sealed boot.key via DPAPI (crash recovery enabled)\n`;
|
|
3439
3446
|
try { fs.appendFileSync(LOG_FILE, sealLog); } catch {}
|