From 6bfbfee261414cb1ce094848c331efcde3f05a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=B3=E8=A5=BF=E5=A6=B2=20=C2=B7=20Nahida?= Date: Thu, 30 Jan 2025 05:21:01 +0800 Subject: [PATCH] feat: can hide / show a proxy for a user use `show` / `ignore` options --- src/model/proxy/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/model/proxy/mod.rs b/src/model/proxy/mod.rs index 633b8f8..c683b7c 100644 --- a/src/model/proxy/mod.rs +++ b/src/model/proxy/mod.rs @@ -25,6 +25,18 @@ impl TryIntoClashStyleProxies for Vec { ) -> Result { let mut new_proxies = vec![]; for mut proxy in self { + if !proxy + .remove("show") + .and_then(|v| yaml::from_value::>(v).ok()) + .map_or(true, |list| list.contains(user.name())) + || proxy + .remove("ignore") + .and_then(|v| yaml::from_value::>(v).ok()) + .map_or(false, |list| list.contains(user.name())) + { + continue; + } + user.insert_password(&mut proxy); insert_up_and_down(