panrouter 1.6.0 → 1.6.1

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.
Files changed (2) hide show
  1. package/package.json +1 -2
  2. package/tray-daemon.ps1 +39 -25
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "panrouter",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "description": "让 Claude Code 免费使用 DeepSeek 等模型,无需 API Key",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "panrouter": "cli.mjs"
8
8
  },
9
- "version": "1.6.0",
10
9
  "files": [
11
10
  "cli.mjs",
12
11
  "daemon.mjs",
package/tray-daemon.ps1 CHANGED
@@ -42,10 +42,46 @@ $bmp.Dispose()
42
42
  $notifyIcon = New-Object System.Windows.Forms.NotifyIcon
43
43
  $notifyIcon.Icon = $icon
44
44
  $notifyIcon.Text = "Pan Router | 端口 50816"
45
- $notifyIcon.Visible = $true
46
- Write-Log "NotifyIcon visible"
47
45
 
48
- # ─── 健康检查 ──────────────────────────────────────
46
+ # ─── 右键菜单 (PS5.1 用 .GetNewClosure()) ─────────
47
+ $menu = New-Object System.Windows.Forms.ContextMenuStrip
48
+
49
+ $titleItem = New-Object System.Windows.Forms.ToolStripMenuItem
50
+ $titleItem.Text = "Pan Router - :50816"
51
+ $titleItem.Enabled = $false
52
+ $titleItem.Font = New-Object System.Drawing.Font("Segoe UI", 9, [System.Drawing.FontStyle]::Bold)
53
+ [void]$menu.Items.Add($titleItem)
54
+ [void]$menu.Items.Add((New-Object System.Windows.Forms.ToolStripSeparator))
55
+
56
+ $autoItem = New-Object System.Windows.Forms.ToolStripMenuItem
57
+ $autoItem.Text = "开机自启动"
58
+ $autoItem.Checked = Get-Autostart
59
+ $autoItem.Add_Click({
60
+ $ni = $notifyIcon
61
+ $ai = $autoItem
62
+ if ($ai.Checked) {
63
+ Set-Autostart $false; $ai.Checked = $false
64
+ $ni.ShowBalloonTip(2000, "Pan Router", "开机自启动已关闭", [System.Windows.Forms.ToolTipIcon]::Info)
65
+ } else {
66
+ Set-Autostart $true; $ai.Checked = $true
67
+ $ni.ShowBalloonTip(2000, "Pan Router", "开机自启动已开启 ✓", [System.Windows.Forms.ToolTipIcon]::Info)
68
+ }
69
+ }.GetNewClosure())
70
+ [void]$menu.Items.Add($autoItem)
71
+ [void]$menu.Items.Add((New-Object System.Windows.Forms.ToolStripSeparator))
72
+
73
+ $exitItem = New-Object System.Windows.Forms.ToolStripMenuItem
74
+ $exitItem.Text = "退出"
75
+ $exitItem.Add_Click({
76
+ Write-Log "Exit clicked"
77
+ $notifyIcon.Visible = $false
78
+ [System.Windows.Forms.Application]::Exit()
79
+ }.GetNewClosure())
80
+ [void]$menu.Items.Add($exitItem)
81
+
82
+ $notifyIcon.ContextMenuStrip = $menu
83
+ $notifyIcon.Visible = $true
84
+ Write-Log "NotifyIcon visible with menu"
49
85
  function Test-Online {
50
86
  try {
51
87
  $req = [System.Net.WebRequest]::Create("http://127.0.0.1:50816/health")
@@ -115,28 +151,6 @@ if ($ready) {
115
151
  }
116
152
  }
117
153
 
118
- # 右键菜单
119
- $menu = New-Object System.Windows.Forms.ContextMenuStrip
120
- $titleItem = New-Object System.Windows.Forms.ToolStripMenuItem("Pan Router - :50816")
121
- $titleItem.Enabled = $false
122
- $titleItem.Font = New-Object System.Drawing.Font("Segoe UI", 9, [System.Drawing.FontStyle]::Bold)
123
- $menu.Items.Add($titleItem)
124
- $menu.Items.Add("-")
125
-
126
- $autoItem = New-Object System.Windows.Forms.ToolStripMenuItem("开机自启动")
127
- $autoItem.Checked = Get-Autostart
128
- $autoItem.Add_Click({
129
- if ($autoItem.Checked) { Set-Autostart $false; $autoItem.Checked = $false; $notifyIcon.ShowBalloonTip(2000, "Pan Router", "开机自启动已关闭", [System.Windows.Forms.ToolTipIcon]::Info) }
130
- else { Set-Autostart $true; $autoItem.Checked = $true; $notifyIcon.ShowBalloonTip(2000, "Pan Router", "开机自启动已开启 ✓", [System.Windows.Forms.ToolTipIcon]::Info) }
131
- })
132
- $menu.Items.Add($autoItem)
133
- $menu.Items.Add("-")
134
-
135
- $exitItem = New-Object System.Windows.Forms.ToolStripMenuItem("退出")
136
- $exitItem.Add_Click({ Write-Log "Exit"; $notifyIcon.Visible = $false; [System.Windows.Forms.Application]::Exit() })
137
- $menu.Items.Add($exitItem)
138
- $notifyIcon.ContextMenuStrip = $menu
139
-
140
154
  # 左键: 状态
141
155
  $notifyIcon.Add_MouseClick({
142
156
  if ($_.Button -eq [System.Windows.Forms.MouseButtons]::Left) {