feat: edit system proxy bypass

This commit is contained in:
GyDi
2022-02-14 01:26:24 +08:00
Unverified
parent 8548373742
commit 78a0cfd052
3 changed files with 29 additions and 5 deletions

View File

@@ -281,10 +281,14 @@ pub fn get_cur_proxy(verge_state: State<'_, VergeState>) -> Result<Option<SysPro
/// get the verge config
#[tauri::command]
pub fn get_verge_config(verge_state: State<'_, VergeState>) -> Result<VergeConfig, String> {
match verge_state.0.lock() {
Ok(arc) => Ok(arc.config.clone()),
Err(_) => Err("failed to get verge lock".into()),
let verge = verge_state.0.lock().unwrap();
let mut config = verge.config.clone();
if config.system_proxy_bypass.is_none() && verge.cur_sysproxy.is_some() {
config.system_proxy_bypass = Some(verge.cur_sysproxy.clone().unwrap().bypass)
}
Ok(config)
}
/// patch the verge config