Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix(runtime): download directly when the configured proxy is unusable
Tw93bf472da125bc
diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rsindex 39df6c8d..116d7eb8 100644--- a/src-tauri/src/app/invoke.rs+++ b/src-tauri/src/app/invoke.rs@@ -587,6 +587,16 @@ fn download_client_for_proxy(proxy_url: Option<&str>) -> Result<Client, String>Ok(client)}+/// The client for the app's configured proxy. A proxy address the webview+/// cannot use either (no scheme, an unsupported one) leaves the page loading+/// directly, so downloads go direct too instead of every one failing.+fn download_client_for_config(proxy_url: Option<&str>) -> Result<Client, String> {+ download_client_for_proxy(proxy_url).or_else(|error| {+ eprintln!("[Pake] Ignoring the proxy for downloads: {error}");+ download_client_for_proxy(None)+ })+}+#[cfg(test)]fn download_client() -> Result<Client, String> {download_client_for_proxy(None)@@ -991,7 +1001,7 @@ pub async fn download_file(.try_state::<crate::app::window::MultiWindowState>().map(|state| state.pake_config.proxy_url.clone());- let response = match download_client_for_proxy(configured_proxy.as_deref()) {+ let response = match download_client_for_config(configured_proxy.as_deref()) {Ok(client) => {download_response(&client,@@ -1805,6 +1815,14 @@ mod tests {assert!(download_client_for_proxy(Some("not a url")).is_err());}+ #[test]+ fn an_unusable_proxy_leaves_downloads_direct_like_the_page() {+ for proxy in ["127.0.0.1:7890", "localhost:7890", "ftp://127.0.0.1:21"] {+ assert!(download_client_for_proxy(Some(proxy)).is_err(), "{proxy}");+ assert!(download_client_for_config(Some(proxy)).is_ok(), "{proxy}");+ }+ }+#[test]fn parse_title_unread_count_extracts_leading_counts_without_false_positives() {assert_eq!(parse_title_unread_count("(3) Inbox"), Some(3));