From 412c676144727748d82b3518084ba5c26f70a0c5 Mon Sep 17 00:00:00 2001 From: ctaoist Date: Fri, 20 May 2022 16:51:35 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/core/mod.rs | 8 +++++--- src-tauri/src/core/verge.rs | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs index ac01442..ec4e396 100644 --- a/src-tauri/src/core/mod.rs +++ b/src-tauri/src/core/mod.rs @@ -48,9 +48,10 @@ pub struct Core { impl Core { pub fn new() -> Core { let clash = Clash::new(); - let verge = Verge::new(); + let mut verge = Verge::new(); let profiles = Profiles::new(); let service = Service::new(); + verge.launch_flag = Some(true); Core { clash: Arc::new(Mutex::new(clash)), @@ -382,10 +383,11 @@ impl Core { result.error.map(|err| log::error!("{err}")); }); - let verge = self.verge.lock(); + let mut verge = self.verge.lock(); let silent_start = verge.enable_silent_start.clone(); - if silent_start.unwrap_or(false) { + if silent_start.unwrap_or(false) && verge.launch_flag.unwrap_or(false) { window.emit("script-handler-close", payload).unwrap(); + verge.launch_flag = Some(false); } else { window.emit("script-handler", payload).unwrap(); } diff --git a/src-tauri/src/core/verge.rs b/src-tauri/src/core/verge.rs index a03bde4..0db1621 100644 --- a/src-tauri/src/core/verge.rs +++ b/src-tauri/src/core/verge.rs @@ -37,6 +37,10 @@ pub struct Verge { /// enable proxy guard pub enable_proxy_guard: Option, + /// launch flag + #[serde(skip_serializing)] + pub launch_flag: Option, + /// set system proxy bypass pub system_proxy_bypass: Option,