chore: update

This commit is contained in:
huzibaca 2024-10-10 18:40:39 +08:00
parent 045ddc5ca5
commit d14bda7e7a
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302
3 changed files with 13 additions and 13 deletions

View File

@ -41,14 +41,14 @@ fn get_bypass() -> String {
None => "".to_string(),
};
let bypass = if custom_bypass.is_empty() {
if custom_bypass.is_empty() {
DEFAULT_BYPASS.to_string()
} else if use_default {
format!("{},{}", DEFAULT_BYPASS, custom_bypass)
} else {
custom_bypass
};
bypass
}
}
impl Sysopt {
@ -311,7 +311,7 @@ impl Sysopt {
let sysproxy = Sysproxy::get_system_proxy();
let autoproxy = Autoproxy::get_auto_proxy();
if !sysproxy.is_ok() || !autoproxy.is_ok() {
if sysproxy.is_err() || autoproxy.is_err() {
log::error!(target: "app", "failed to get the system proxy");
continue;
}
@ -367,23 +367,23 @@ impl Sysopt {
let shell = app_handle.shell();
let output = if pac {
let address = format!("http://{}:{}/pac", "127.0.0.1", pac_port);
let output = shell
shell
.command(sysproxy_exe.as_path().to_str().unwrap())
.args(["opac", address.as_str()])
.output()
.await
.unwrap();
output
.unwrap()
} else {
let address = format!("{}:{}", "127.0.0.1", port);
let bypass = get_bypass();
let output = shell
shell
.command(sysproxy_exe.as_path().to_str().unwrap())
.args(["global", address.as_str(), bypass.as_ref()])
.output()
.await
.unwrap();
output
.unwrap()
};
if !output.status.success() {
break;

View File

@ -26,5 +26,5 @@ pub async fn use_tun(mut config: Mapping) -> Mapping {
});
revise!(tun_val, "enable", true);
revise!(config, "tun", tun_val);
return config;
config
}

View File

@ -250,11 +250,11 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> {
Config::verge().apply();
Config::verge().data().save_file()?;
return Ok(());
Ok(())
}
Err(err) => {
Config::verge().discard();
return Err(err);
Err(err)
}
}
}