codepet 1.0.15 → 1.0.17
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/bin/codepet.js +11 -3
- package/package.json +1 -1
package/bin/codepet.js
CHANGED
|
@@ -485,9 +485,17 @@ function doPopup() {
|
|
|
485
485
|
} else if (process.platform === 'win32') {
|
|
486
486
|
// Windows: 弹新 PowerShell 窗口,自动开启 ANSI 彩色支持
|
|
487
487
|
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py').replace(/\\/g, '/');
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
|
|
488
|
+
// 写临时 PS1 脚本避免转义问题
|
|
489
|
+
const tmpPs1 = path.join(os.tmpdir(), 'codepet_photo.ps1');
|
|
490
|
+
const ps1Content = `
|
|
491
|
+
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
492
|
+
$Host.UI.RawUI.WindowTitle = '📸 Ai小蓝鲸照相馆'
|
|
493
|
+
try { Set-ItemProperty HKCU:\\Console VirtualTerminalLevel -Type DWORD -Value 1 -ErrorAction SilentlyContinue } catch {}
|
|
494
|
+
& ${PYTHON} "${script}" ${pet.character} ${scene} 40
|
|
495
|
+
Read-Host
|
|
496
|
+
`;
|
|
497
|
+
fs.writeFileSync(tmpPs1, ps1Content, 'utf-8');
|
|
498
|
+
execSync(`start powershell -NoProfile -ExecutionPolicy Bypass -File "${tmpPs1}"`, { shell: true, stdio: 'ignore' });
|
|
491
499
|
} else {
|
|
492
500
|
// Linux: 尝试终端弹窗
|
|
493
501
|
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py');
|