diff --git a/src-tauri/src/config/runtime.rs b/src-tauri/src/config/runtime.rs index 3b67b06..cce376b 100644 --- a/src-tauri/src/config/runtime.rs +++ b/src-tauri/src/config/runtime.rs @@ -15,4 +15,17 @@ impl IRuntime { pub fn new() -> Self { Self::default() } + + // 这里只更改 allow-lan | ipv6 | log-level + pub fn patch_config(&mut self, patch: Mapping) { + if let Some(config) = self.config.as_mut() { + ["allow-lan", "ipv6", "log-level"] + .into_iter() + .for_each(|key| { + if let Some(value) = patch.get(key).to_owned() { + config.insert(key.into(), value.clone()); + } + }); + } + } } diff --git a/src-tauri/src/feat.rs b/src-tauri/src/feat.rs index 7ae48ca..1e49117 100644 --- a/src-tauri/src/feat.rs +++ b/src-tauri/src/feat.rs @@ -183,6 +183,8 @@ pub async fn patch_clash(patch: Mapping) -> Result<()> { log_err!(handle::Handle::update_systray_part()); } + Config::runtime().latest().patch_config(patch); + <Result<()>>::Ok(()) } { Ok(()) => {