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); }