fix: 解决终端窗口闪现问题

- 在 Windows 上为所有外部命令添加 CREATE_NO_WINDOW 标志
- 修复托盘复制 API 地址功能
- 修复打开配置文件夹和认证目录功能
- 修复工具版本检查功能
- 添加 sonner 依赖解决前端构建问题
- 修复代码格式问题
This commit is contained in:
L_SEN
2025-12-20 16:07:09 +08:00
parent ffaa1bdc5a
commit 2e79602803
3 changed files with 59 additions and 2 deletions
+2 -2
View File
@@ -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",
+53
View File
@@ -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<Vec<ToolVersion>, 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<Vec<ToolVersion>, 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<Vec<ToolVersion>, 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<bool, String> {
{
std::process::Command::new("explorer")
.arg(&expanded)
.creation_flags(0x08000000) // CREATE_NO_WINDOW
.spawn()
.map_err(|e| e.to_string())?;
}
+4
View File
@@ -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<R: Runtime>(app: &AppHandle<R>) {
{
let _ = std::process::Command::new("cmd")
.args(["/C", &format!("echo {} | clip", api_address)])
.creation_flags(0x08000000) // CREATE_NO_WINDOW
.spawn();
info!("[托盘] API 地址已复制到剪贴板: {}", api_address);
}