fix: recover BPM browsers and harden redaction and Windows supervision

This commit is contained in:
abaishu0730 committed 2026-10-19 08:56:10 +08:00
1 parent acba28c879
commit db98d78f6b
14 files changed
+223 -59

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ test('Windows login shortcut uses the current account, supports spaces and can b
const {installAutostart,uninstallAutostart,readShortcut}=require('../../src/platform/service/windows-startup.cjs'),root=await fs.mkdtemp(path.join(os.tmpdir(),'order startup ')),startupDir=path.join(root,'登录启动'),stateDir=path.join(root,'状态库');t.after(()=>fs.rm(root,{recursive:true,force:true}));
const projectRoot=path.join(root,'项目 带空格'),marker=path.join(root,'started.txt');await fs.mkdir(path.join(projectRoot,'scripts'),{recursive:true});await fs.writeFile(path.join(projectRoot,'scripts','service.cjs'),'require("node:fs").writeFileSync('+JSON.stringify(marker)+',process.argv[2]);');
const installed=installAutostart({stateDir,startupDir,projectRoot,nodePath:process.execPath});const shortcut=readShortcut(installed.linkPath);
assert.match(shortcut.target,/wscript\.exe$/i);assert.ok(shortcut.args.includes(installed.launcherPath));assert.equal(installed.enabled,true);
assert.match(shortcut.target,/wscript\.exe$/i);assert.equal(shortcut.args,'//B "'+installed.launcherPath+'"');assert.equal(shortcut.cwd,projectRoot);assert.equal(installed.enabled,true);
require('node:child_process').execFileSync('cscript.exe',['//Nologo','//B',installed.launcherPath],{windowsHide:true,timeout:5000});
const deadline=Date.now()+5000;while(Date.now()<deadline){try{if(await fs.readFile(marker,'utf8')==='run')break;}catch{}await new Promise(r=>setTimeout(r,100));}assert.equal(await fs.readFile(marker,'utf8'),'run');
const twice=installAutostart({stateDir,startupDir,projectRoot,nodePath:process.execPath});assert.equal(twice.linkPath,installed.linkPath);