fix: use full clash config

This commit is contained in:
GyDi 2022-02-23 23:23:07 +08:00
parent dd15455031
commit bbe2ef4e8e
No known key found for this signature in database
GPG Key ID: 1C95E0D3467B3084

View File

@ -329,7 +329,9 @@ pub async fn activate_profile(
// begin to generate the new profile config // begin to generate the new profile config
let def_config = config::read_yaml::<Mapping>(file_path.clone()); 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: // Only the following fields are allowed:
// proxies/proxy-providers/proxy-groups/rule-providers/rules // 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( config::save_yaml(
temp_path.clone(), temp_path.clone(),
&new_config, &new_config,