Skip to content

Commit

Permalink
feat: can hide / show a proxy for a user use show / ignore options
Browse files Browse the repository at this point in the history
  • Loading branch information
Buer-Nahida committed Jan 29, 2025
1 parent 580f93b commit 6bfbfee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/model/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ impl TryIntoClashStyleProxies for Vec<Mapping> {
) -> Result<ClashStyleProxies> {
let mut new_proxies = vec![];
for mut proxy in self {
if !proxy
.remove("show")
.and_then(|v| yaml::from_value::<Vec<String>>(v).ok())
.map_or(true, |list| list.contains(user.name()))
|| proxy
.remove("ignore")
.and_then(|v| yaml::from_value::<Vec<String>>(v).ok())
.map_or(false, |list| list.contains(user.name()))
{
continue;
}

user.insert_password(&mut proxy);

insert_up_and_down(
Expand Down

0 comments on commit 6bfbfee

Please sign in to comment.