diff --git a/src-tauri/src/core/clash.rs b/src-tauri/src/core/clash.rs index dad2ab7c7c31083c068a2b1757fb91a437bd1a1e..6e200d03e856225331d5dd23d7c913971a11cbe2 100644 --- a/src-tauri/src/core/clash.rs +++ b/src-tauri/src/core/clash.rs @@ -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(); }