fix: limit enhanced profile range
This commit is contained in:
parent
c72f17605c
commit
c0ad84a491
@ -320,9 +320,28 @@ impl Clash {
|
|||||||
let result: PrfEnhancedResult = serde_json::from_str(result).unwrap();
|
let result: PrfEnhancedResult = serde_json::from_str(result).unwrap();
|
||||||
|
|
||||||
if let Some(data) = result.data {
|
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() {
|
for (key, value) in data.into_iter() {
|
||||||
|
if not_allow.iter().find(|&i| i == &key).is_none() {
|
||||||
config.insert(key, value);
|
config.insert(key, value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Self::_activate(info, config).unwrap();
|
Self::_activate(info, config).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user