feat: complete workflow recovery and safe administration

This commit is contained in:
abaishu0730 committed 2026-10-21 12:30:11 +08:00
1 parent 1148aa6f14
commit 69583e8c33
46 files changed
+756 -120

No files matched your search

+10 -3
View File
@@ -13,9 +13,16 @@ function directoryIdentity(dir){const info=fs.lstatSync(dir,{bigint:true});if(!i
function powershell(script, input) {
const utf8='[Console]::InputEncoding=New-Object System.Text.UTF8Encoding; [Console]::OutputEncoding=New-Object System.Text.UTF8Encoding; ';
return execFileSync('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', utf8+script], {
input, encoding: 'utf8', windowsHide: true, timeout: 15000, stdio: ['pipe', 'pipe', 'pipe']
}).trim();
for(let attempt=0;attempt<2;attempt++){
try{return execFileSync('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', utf8+script], {
input, encoding: 'utf8', windowsHide: true, timeout: 15000, stdio: ['pipe', 'pipe', 'pipe']
}).trim();}catch(error){
if(attempt||error.code!=='ETIMEDOUT')throw error;
// Only fixed ACL/DPAPI operations reach this helper. The timed-out child
// has exited; retry the same input once before any key is published.
console.error('存储保护调用重试:'+JSON.stringify({stage:'windows_protection',code:'ETIMEDOUT',attempt:2}));
}
}
}
function secureDirectory(dir) {
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });