Pārlūkot izejas kodu

fix: use full clash config

GyDi 3 gadi atpakaļ
vecāks
revīzija
bbe2ef4e8e
1 mainītis faili ar 3 papildinājumiem un 19 dzēšanām
  1. 3 19
      src-tauri/src/core/profiles.rs

+ 3 - 19
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::<Mapping>(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,