minimize log

This commit is contained in:
Julian Freeman
2026-03-14 22:57:42 -04:00
parent 714db81938
commit 8f55da1940

View File

@@ -36,7 +36,6 @@ pub fn emit_log(handle: &AppHandle, id: &str, command: &str, output: &str, statu
#[tauri::command] #[tauri::command]
async fn initialize_app(app: AppHandle) -> Result<bool, String> { async fn initialize_app(app: AppHandle) -> Result<bool, String> {
// 统一由前端触发环境初始化
tokio::task::spawn_blocking(move || { tokio::task::spawn_blocking(move || {
ensure_winget_dependencies(&app).map(|_| true) ensure_winget_dependencies(&app).map(|_| true)
}).await.unwrap_or(Err("Initialization Task Panicked".to_string())) }).await.unwrap_or(Err("Initialization Task Panicked".to_string()))
@@ -116,9 +115,6 @@ pub fn run() {
let (tx, mut rx) = mpsc::channel::<String>(100); let (tx, mut rx) = mpsc::channel::<String>(100);
app.manage(AppState { install_tx: tx }); app.manage(AppState { install_tx: tx });
// 移除了 setup 钩子中的 redundancy initialize_app 调用
// 安装队列处理器
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
let perc_re = Regex::new(r"(\d+)\s*%").unwrap(); let perc_re = Regex::new(r"(\d+)\s*%").unwrap();
let size_re = Regex::new(r"([\d\.]+)\s*[a-zA-Z]+\s*/\s*([\d\.]+)\s*[a-zA-Z]+").unwrap(); let size_re = Regex::new(r"([\d\.]+)\s*[a-zA-Z]+\s*/\s*([\d\.]+)\s*[a-zA-Z]+").unwrap();
@@ -183,7 +179,8 @@ pub fn run() {
} }
} }
if !is_progress { // 净化日志:过滤进度行、单字符动画行以及退格符
if !is_progress && clean_line.chars().count() > 1 {
emit_log(&h, &log_id, "", clean_line, "info"); emit_log(&h, &log_id, "", clean_line, "info");
} }
} }