fix+build(client/windows): 复查修缮——一键构建脚本 + 修 README dart-define 漏项 + 清 lint

- 新增 client/windows/build.ps1:拉内核→带 --dart-define 构建→出安装包一键串联,
  规避 Release 漏 --dart-define 导致默认连 localhost、登录「网络请求失败」的坑。
- README:Release 命令补回 --dart-define 并加显式警告,指向一键脚本。
- 清 4 个 lint warning:desktop_vpn_bridge 多余 cast→pattern match、去多余非空断言;
  nav_sidebar 删未用 import;vpn_bridge_mock 加 killSwitchEnabled getter。
- 同步 window_manager/tray_manager/screen_retriever 插件注册生成文件(win+macos)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-22 14:17:13 +08:00
parent d7c2e22e6f
commit 322d806876
8 changed files with 135 additions and 5 deletions
+14 -1
View File
@@ -49,10 +49,23 @@ flutter run -d windows --dart-define=PANGOLIN_API_URL=http://<后端IP>:8080
## 打包(release
**推荐:一键脚本**(拉内核 → 带 dart-define 构建 → 出安装包,自动避开漏 `--dart-define` 的坑):
```powershell
powershell -ExecutionPolicy Bypass -File client\windows\build.ps1 -ApiUrl http://<后端IP>:8080
# 只构建不出安装包:加 -SkipInstaller
```
或手动分步:
```powershell
cd client
flutter build windows
# 必须带 --dart-define 指定后端,否则默认连 localhost:8080,登录会「网络请求失败」
flutter build windows --dart-define=PANGOLIN_API_URL=http://<后端IP>:8080
```
> ⚠️ `kApiBaseUrl` 默认值是 `http://localhost:8080`(见 `lib/services/api_config.dart`)。
> Release 包必须显式 `--dart-define=PANGOLIN_API_URL=...`,构建期烘进二进制;漏了会复现登录失败。
CMake 的 install 步骤会自动把 `app/kernel/dist/desktop/windows-*/{sing-box.exe, wintun.dll}`
拷到 app `.exe` 同级目录(见 `windows/CMakeLists.txt` 的「Pangolin sing-box kernel」段)。
**wintun.dll 必须与 sing-box.exe 同目录**,否则 sing-box 无法创建 TUN。