diff --git a/src/client/proxy.rs b/src/client/proxy.rs index 80faa347..7ee05268 100644 --- a/src/client/proxy.rs +++ b/src/client/proxy.rs @@ -16,60 +16,15 @@ impl ReqClient { pub fn build() -> ConcurrencyLimit { let settings = gtk::gio::Settings::new(crate::APP_ID); - let client_builder = reqwest::Client::builder() + let client = reqwest::Client::builder() .user_agent(APP_USER_AGENT.to_string()) .timeout(std::time::Duration::from_secs(10)) - .pool_max_idle_per_host(settings.int("threads") as usize); - - let client = if let Some(proxy_url) = get_proxy_settings() { - match reqwest::Proxy::all(proxy_url) { - Ok(proxy) => client_builder.proxy(proxy), - Err(_) => { - tracing::warn!("Failed to set proxy settings, using default client"); - client_builder - } - } - } else { - client_builder - } - .build() - .expect("failed to initialize client"); + .pool_max_idle_per_host(settings.int("threads") as usize) + .build() + .expect("failed to initialize client"); tower::ServiceBuilder::new() .concurrency_limit(SETTINGS.threads() as usize) .service(client) } -} - -#[cfg(target_os = "windows")] -use windows::{ - core::PCWSTR, - Win32::Networking::WinHttp::{ - WinHttpGetIEProxyConfigForCurrentUser, - WINHTTP_CURRENT_USER_IE_PROXY_CONFIG, - }, -}; - -#[cfg(target_os = "windows")] -pub fn get_proxy_settings() -> Option { - unsafe { - let mut proxy_config = WINHTTP_CURRENT_USER_IE_PROXY_CONFIG::default(); - - if WinHttpGetIEProxyConfigForCurrentUser(&mut proxy_config).is_ok() - && !proxy_config.lpszProxy.is_null() - { - let proxy = PCWSTR(proxy_config.lpszProxy.0).to_string().unwrap(); - return Some(proxy); - } - } - None -} - -#[cfg(target_os = "linux")] -pub fn get_proxy_settings() -> Option { - use std::env; - - env::var("http_proxy") - .or_else(|_| env::var("https_proxy")) - .ok() -} +} \ No newline at end of file