Skip to content

Commit

Permalink
fix: use default bypass when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
MystiPanda committed May 13, 2024
1 parent 4064129 commit 3fc969a
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src-tauri/src/core/sysopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ impl Sysopt {
enable,
host: String::from("127.0.0.1"),
port,
bypass: bypass.unwrap_or(DEFAULT_BYPASS.into()),
bypass: match bypass {
Some(bypass) => {
if bypass.is_empty() {
DEFAULT_BYPASS.into()
} else {
bypass
}
}
None => DEFAULT_BYPASS.into(),
},
};

if enable {
Expand Down Expand Up @@ -101,7 +110,16 @@ impl Sysopt {
let mut sysproxy = cur_sysproxy.take().unwrap();

sysproxy.enable = enable;
sysproxy.bypass = bypass.unwrap_or(DEFAULT_BYPASS.into());
sysproxy.bypass = match bypass {
Some(bypass) => {
if bypass.is_empty() {
DEFAULT_BYPASS.into()
} else {
bypass
}
}
None => DEFAULT_BYPASS.into(),
};

let port = Config::verge()
.latest()
Expand Down Expand Up @@ -281,7 +299,16 @@ impl Sysopt {
enable: true,
host: "127.0.0.1".into(),
port,
bypass: bypass.unwrap_or(DEFAULT_BYPASS.into()),
bypass: match bypass {
Some(bypass) => {
if bypass.is_empty() {
DEFAULT_BYPASS.into()
} else {
bypass
}
}
None => DEFAULT_BYPASS.into(),
},
};

log_err!(sysproxy.set_system_proxy());
Expand Down

0 comments on commit 3fc969a

Please sign in to comment.