Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix(runtime): keep the download proxy branch clippy-clean off macOS

Tw938207d1f43dd7
diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs
index c1333685..40198b6e 100644
--- a/src-tauri/src/app/invoke.rs
+++ b/src-tauri/src/app/invoke.rs
@@ -561,19 +561,19 @@ fn normalize_proxy_url(proxy_url: Option<&str>) -> Result<Option<String>, String
fn build_download_client(proxy_url: Option<&str>) -> Result<Client, String> {
let normalized = normalize_proxy_url(proxy_url)?;
let mut builder = ClientBuilder::new().redirect(Policy::none()).referer(false);
- match &normalized {
- Some(proxy) => {
- let reqwest_proxy =
- Proxy::all(proxy).map_err(|e| format!("Invalid download proxy URL: {e}"))?;
- builder = builder.proxy(reqwest_proxy);
- }
- None =>
- {
- #[cfg(target_os = "macos")]
- if let Some(rule) = macos_system_proxy().and_then(system_proxy_rule) {
- builder = builder.proxy(rule);
- }
- }
+ if let Some(proxy) = &normalized {
+ let reqwest_proxy =
+ Proxy::all(proxy).map_err(|e| format!("Invalid download proxy URL: {e}"))?;
+ builder = builder.proxy(reqwest_proxy);
+ }
+ #[cfg(target_os = "macos")]
+ if let Some(rule) = normalized
+ .is_none()
+ .then(macos_system_proxy)
+ .flatten()
+ .and_then(system_proxy_rule)
+ {
+ builder = builder.proxy(rule);
}
builder
.build()