panrouter 3.5.0 → 3.6.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/package.json +1 -1
- package/tray-daemon.ps1 +4 -1
package/package.json
CHANGED
package/tray-daemon.ps1
CHANGED
|
@@ -15,6 +15,8 @@ try {
|
|
|
15
15
|
|
|
16
16
|
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
|
|
17
17
|
$serverPath = Join-Path $scriptDir "server.mjs"
|
|
18
|
+
# 【修复1】:在全局作用域提前把准确的脚本路径存下来,防止在 Click 事件块内丢失
|
|
19
|
+
$trayScriptPath = $MyInvocation.MyCommand.Path
|
|
18
20
|
|
|
19
21
|
$nodePath = $env:PANROUTER_NODE
|
|
20
22
|
if ([string]::IsNullOrWhiteSpace($nodePath)) {
|
|
@@ -102,7 +104,8 @@ try {
|
|
|
102
104
|
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v PanRouter /f 2>&1 | Out-Null
|
|
103
105
|
$autoItem.Checked = $false
|
|
104
106
|
} else {
|
|
105
|
-
|
|
107
|
+
# 【修复2】:写入注册表时,务必加上 -STA 参数防止 UI 闪退,并使用刚刚存好的 $trayScriptPath
|
|
108
|
+
$cmd = "powershell.exe -WindowStyle Hidden -STA -ExecutionPolicy Bypass -File `"$trayScriptPath`""
|
|
106
109
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v PanRouter /t REG_SZ /d $cmd /f 2>&1 | Out-Null
|
|
107
110
|
$autoItem.Checked = $true
|
|
108
111
|
}
|