From f8249d70aaef80e168304173c662afd57239f4c9 Mon Sep 17 00:00:00 2001 From: Pylogmon Date: Fri, 14 Jul 2023 11:43:19 +0800 Subject: [PATCH] fix: Unspecified proxy lookup on Linux --- src-tauri/src/config.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index 80f1f73895..cb0d4a3bbe 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -168,8 +168,14 @@ pub fn create_background_window() { #[tauri::command] pub fn set_proxy(proxy: &str) -> Result<(), ()> { - std::env::set_var("http_proxy", proxy); - std::env::set_var("https_proxy", proxy); - std::env::set_var("all_proxy", proxy); + if proxy.is_empty(){ + std::env::remove_var("http_proxy"); + std::env::remove_var("https_proxy"); + std::env::remove_var("all_proxy"); + }else{ + std::env::set_var("http_proxy", proxy); + std::env::set_var("https_proxy", proxy); + std::env::set_var("all_proxy", proxy); + } Ok(()) }