From bbe2ef4e8e03d2a75ffd1baa1cbed5f8e60c4752 Mon Sep 17 00:00:00 2001 From: GyDi Date: Wed, 23 Feb 2022 23:23:07 +0800 Subject: [PATCH] fix: use full clash config --- src-tauri/src/core/profiles.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src-tauri/src/core/profiles.rs b/src-tauri/src/core/profiles.rs index e81b892..551deeb 100644 --- a/src-tauri/src/core/profiles.rs +++ b/src-tauri/src/core/profiles.rs @@ -329,7 +329,9 @@ pub async fn activate_profile( // begin to generate the new profile config let def_config = config::read_yaml::(file_path.clone()); - let mut new_config = Mapping::new(); + + // use the clash config except 5 keys below + let mut new_config = clash_config.clone(); // Only the following fields are allowed: // proxies/proxy-providers/proxy-groups/rule-providers/rules @@ -348,24 +350,6 @@ pub async fn activate_profile( } }); - // add some of the clash `config.yaml` config to it - let valid_keys = vec![ - "mixed-port", - "log-level", - "allow-lan", - "external-controller", - "secret", - "mode", - "ipv6", - ]; - valid_keys.iter().for_each(|key| { - let key = Value::String(key.to_string()); - if clash_config.contains_key(&key) { - let value = clash_config[&key].clone(); - new_config.insert(key, value); - } - }); - config::save_yaml( temp_path.clone(), &new_config,