fix: limit enhanced profile range

This commit is contained in:
GyDi 2022-03-08 01:45:46 +08:00
parent c72f17605c
commit c0ad84a491
No known key found for this signature in database
GPG Key ID: 58B15242BA8277A6

View File

@ -320,9 +320,28 @@ impl Clash {
let result: PrfEnhancedResult = serde_json::from_str(result).unwrap();
if let Some(data) = result.data {
// all of these can not be revised by script
// http/https/socks port should be under control
let not_allow: Vec<Value> = vec![
"port",
"socks-port",
"mixed-port",
"allow-lan",
"mode",
"external-controller",
"secret",
"log-level",
]
.iter()
.map(|&i| Value::from(i))
.collect();
for (key, value) in data.into_iter() {
config.insert(key, value);
if not_allow.iter().find(|&i| i == &key).is_none() {
config.insert(key, value);
}
}
Self::_activate(info, config).unwrap();
}