From 2e7960280390d42dfaa185e881b5e97279c6b661 Mon Sep 17 00:00:00 2001 From: L_SEN <823158062@qq.com> Date: Sat, 20 Dec 2025 16:07:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E9=97=AA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 Windows 上为所有外部命令添加 CREATE_NO_WINDOW 标志 - 修复托盘复制 API 地址功能 - 修复打开配置文件夹和认证目录功能 - 修复工具版本检查功能 - 添加 sonner 依赖解决前端构建问题 - 修复代码格式问题 --- package-lock.json | 4 +-- src-tauri/src/commands/config_cmd.rs | 53 ++++++++++++++++++++++++++++ src-tauri/src/tray/menu_handler.rs | 4 +++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e48a06f3..aa6b336ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "proxycast", - "version": "0.14.0", + "version": "0.14.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "proxycast", - "version": "0.14.0", + "version": "0.14.2", "dependencies": { "@radix-ui/react-dialog": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.1.2", diff --git a/src-tauri/src/commands/config_cmd.rs b/src-tauri/src/commands/config_cmd.rs index f455cedf2..3d3f3d925 100644 --- a/src-tauri/src/commands/config_cmd.rs +++ b/src-tauri/src/commands/config_cmd.rs @@ -8,6 +8,9 @@ use std::path::PathBuf; use tauri::AppHandle; use tauri_plugin_autostart::ManagerExt; +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigStatus { pub exists: bool, @@ -85,6 +88,7 @@ pub async fn open_config_folder(_handle: AppHandle, app_type: String) -> Result< { std::process::Command::new("explorer") .arg(&config_dir) + .creation_flags(0x08000000) // CREATE_NO_WINDOW .spawn() .map_err(|e| e.to_string())?; } @@ -112,6 +116,22 @@ pub async fn get_tool_versions() -> Result, String> { let mut versions = Vec::new(); // Check Claude Code version + #[cfg(target_os = "windows")] + let claude_version = std::process::Command::new("claude") + .arg("--version") + .creation_flags(0x08000000) // CREATE_NO_WINDOW + .output() + .ok() + .and_then(|o| { + if o.status.success() { + String::from_utf8(o.stdout).ok() + } else { + None + } + }) + .map(|s| s.trim().to_string()); + + #[cfg(not(target_os = "windows"))] let claude_version = std::process::Command::new("claude") .arg("--version") .output() @@ -132,6 +152,22 @@ pub async fn get_tool_versions() -> Result, String> { }); // Check Codex version + #[cfg(target_os = "windows")] + let codex_version = std::process::Command::new("codex") + .arg("--version") + .creation_flags(0x08000000) // CREATE_NO_WINDOW + .output() + .ok() + .and_then(|o| { + if o.status.success() { + String::from_utf8(o.stdout).ok() + } else { + None + } + }) + .map(|s| s.trim().to_string()); + + #[cfg(not(target_os = "windows"))] let codex_version = std::process::Command::new("codex") .arg("--version") .output() @@ -152,6 +188,22 @@ pub async fn get_tool_versions() -> Result, String> { }); // Check Gemini CLI version + #[cfg(target_os = "windows")] + let gemini_version = std::process::Command::new("gemini") + .arg("--version") + .creation_flags(0x08000000) // CREATE_NO_WINDOW + .output() + .ok() + .and_then(|o| { + if o.status.success() { + String::from_utf8(o.stdout).ok() + } else { + None + } + }) + .map(|s| s.trim().to_string()); + + #[cfg(not(target_os = "windows"))] let gemini_version = std::process::Command::new("gemini") .arg("--version") .output() @@ -559,6 +611,7 @@ pub async fn open_auth_dir(path: String) -> Result { { std::process::Command::new("explorer") .arg(&expanded) + .creation_flags(0x08000000) // CREATE_NO_WINDOW .spawn() .map_err(|e| e.to_string())?; } diff --git a/src-tauri/src/tray/menu_handler.rs b/src-tauri/src/tray/menu_handler.rs index 12b69c988..b28862962 100644 --- a/src-tauri/src/tray/menu_handler.rs +++ b/src-tauri/src/tray/menu_handler.rs @@ -12,6 +12,9 @@ use tauri::{AppHandle, Emitter, Manager, Runtime}; use tauri_plugin_autostart::ManagerExt; use tracing::{debug, error, info, warn}; +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; + /// 菜单事件类型 /// /// 用于前端监听的事件名称 @@ -191,6 +194,7 @@ fn handle_copy_api_address(app: &AppHandle) { { let _ = std::process::Command::new("cmd") .args(["/C", &format!("echo {} | clip", api_address)]) + .creation_flags(0x08000000) // CREATE_NO_WINDOW .spawn(); info!("[托盘] API 地址已复制到剪贴板: {}", api_address); }