diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 543f88c..fdc404e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -31,8 +31,12 @@ pub struct InstallTask { #[serde(default)] pub use_manifest: bool, pub manifest_url: Option, + #[serde(default = "default_true")] + pub enable_post_install: bool, } +fn default_true() -> bool { true } + impl Default for AppSettings { fn default() -> Self { Self { @@ -116,7 +120,6 @@ async fn sync_essentials(app: AppHandle) -> Result { Ok(response) => { if response.status().is_success() { let content = response.text().await.map_err(|e| e.to_string())?; - // 验证 JSON 格式(新格式:{ version: string, essentials: Vec }) let validation: Result = serde_json::from_str(&content); if validation.is_ok() { let path = get_essentials_path(&app); @@ -194,11 +197,9 @@ fn expand_win_path(path: &str) -> PathBuf { ]; for var in env_vars { - // 创建不区分大小写的正则表达式,匹配 %VAR% let re = Regex::new(&format!(r"(?i)%{}%", var)).unwrap(); if re.is_match(&expanded) { if let Ok(val) = std::env::var(var) { - // 使用正则表达式替换所有匹配项 expanded = re.replace_all(&expanded, val.as_str()).to_string(); } } @@ -211,7 +212,6 @@ async fn execute_post_install(handle: &AppHandle, log_id: &str, steps: Vec *delay_ms, PostInstallStep::FileCopy { delay_ms, .. } => *delay_ms, @@ -335,7 +335,6 @@ async fn execute_post_install(handle: &AppHandle, log_id: &str, steps: Vec 0 { emit_log(handle, log_id, "Post-Install", &format!("Waiting for {}ms...", ms), "info"); @@ -370,6 +369,7 @@ pub fn run() { let task_version = task.version.clone(); let use_manifest = task.use_manifest; let manifest_url = task.manifest_url.clone(); + let enable_post_install_flag = task.enable_post_install; let log_id = format!("install-{}", task_id); @@ -494,7 +494,7 @@ pub fn run() { let exit_status = child_proc.wait().map(|s| s.success()).unwrap_or(false); let status_result = if exit_status { "success" } else { "error" }; - if status_result == "success" { + if status_result == "success" && enable_post_install_flag { let essentials = get_essentials(handle.clone()); let software_info = essentials.and_then(|repo| { repo.essentials.into_iter().find(|s| s.id == task_id) diff --git a/src/components/SoftwareCard.vue b/src/components/SoftwareCard.vue index 2cbc492..d3c3e43 100644 --- a/src/components/SoftwareCard.vue +++ b/src/components/SoftwareCard.vue @@ -35,7 +35,6 @@ {{ software.id }}
- - diff --git a/src/views/Updates.vue b/src/views/Updates.vue index 8c2122a..f0bf49b 100644 --- a/src/views/Updates.vue +++ b/src/views/Updates.vue @@ -58,14 +58,16 @@ +