windows: the app sets the system proxy; ps-core lint fixes

- The app points the signed-in user's system proxy (WinINet: browsers
  and most programs follow it) at the local proxy while it runs and
  proxy.systemProxy.enable asks; the user's own settings are kept and put
  back when the proxy stops, the service goes, the option is turned off
  or the app quits; one left behind by a killed app is cleared. A switch
  for it on the overview. Elsewhere than Windows it does nothing.
- ps-core: clippy's collapsible ifs, comparisons without owned values, a
  range loop without indexing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 02:07:02 +03:00
1 parent 77becc235c
commit 7565e62571
9 files changed
+248 -17

No files matched your search

+8 -8
View File
@@ -73,15 +73,15 @@ impl Source {
return None;
}
let rel = entry.strip_prefix(self.strip.as_str())?;
if let Some(files) = &self.files {
if !files.contains_key(rel) {
return None;
}
if let Some(files) = &self.files
&& !files.contains_key(rel)
{
return None;
}
if let Some(include) = &self.include {
if !matches(include, rel) {
return None;
}
if let Some(include) = &self.include
&& !matches(include, rel)
{
return None;
}
if matches(&self.exclude, rel) {
return None;
@@ -538,7 +538,7 @@ fn chain(b: &mut Builder, warnings: &mut Vec<String>) {
if drop.is_empty() {
for (t, hop) in &hops {
let set = |ob: &mut Value| {
if ob["tag"] == Value::from(t.as_str()) {
if ob["tag"] == t.as_str() {
if xray_tags.contains(t) || b.backend == Backend::Xray {
ob["streamSettings"]["sockopt"]["dialerProxy"] = hop.clone().into();
} else {
@@ -554,7 +554,7 @@ fn chain(b: &mut Builder, warnings: &mut Vec<String>) {
}
for (t, why) in drop {
warnings.push(format!("outbound '{t}': {why}; leaving it out"));
let keep = |o: &Value| o["tag"] != Value::from(t.as_str());
let keep = |o: &Value| o["tag"] != t.as_str();
b.outbounds.retain(keep);
b.endpoints.retain(keep);
b.xray.retain(keep);
+4 -4
View File
@@ -47,10 +47,10 @@ pub fn conf_sections(config: &str) -> Vec<Section> {
let stripped = line.split('#').next().unwrap_or("").split(';').next().unwrap_or("").trim();
if stripped.starts_with('[') && stripped.ends_with(']') && stripped.len() >= 2 {
sections.push((stripped[1..stripped.len() - 1].trim().to_lowercase(), Vec::new()));
} else if let Some((key, value)) = stripped.split_once('=') {
if let Some(last) = sections.last_mut() {
last.1.push((key.trim().to_lowercase(), value.trim().to_owned()));
}
} else if let Some((key, value)) = stripped.split_once('=')
&& let Some(last) = sections.last_mut()
{
last.1.push((key.trim().to_lowercase(), value.trim().to_owned()));
}
}
sections
+2 -1
View File
@@ -214,8 +214,9 @@ fn merge_ports(lists: &[&str]) -> String {
}
let mut out = Vec::new();
let mut start = 0;
// One past the last port, so a run that reaches 65535 ends too.
for port in 1..=65536usize {
if port <= 65535 && on[port] {
if on.get(port).copied().unwrap_or(false) {
if start == 0 {
start = port;
}