diff --git a/src-tauri/src/proxy.rs b/src-tauri/src/proxy.rs index cb85c77..999458b 100644 --- a/src-tauri/src/proxy.rs +++ b/src-tauri/src/proxy.rs @@ -75,6 +75,8 @@ impl HttpHandler for ProxyHandler { * Starts an HTTP(S) proxy server. */ pub async fn create_proxy(proxy_port: u16, certificate_path: String) { + let cert_path = std::PathBuf::from(certificate_path); + // Get the certificate and private key. let mut private_key_bytes: &[u8] = &fs::read(format!("{}\\private.key", certificate_path)).expect("Could not read private key"); @@ -144,17 +146,18 @@ pub fn connect_to_proxy(proxy_port: u16) { let mut env_file = match fs::read_to_string("/etc/environment") { Ok(f) => f, Err(e) => { - println!("Error opening /etc/environment: {}", e) + println!("Error opening /etc/environment: {}", e); + return; } }; // Append the proxy configuration. // We will not remove the current proxy config if it exists, so we can just remove these last lines when we disconnect - env_file += format!("\nhttps_proxy=127.0.0.1:{}", proxy_port); - env_file += format!("\nhttp_proxy=127.0.0.1:{}", proxy_port); + env_file += format!("\nhttps_proxy=127.0.0.1:{}", proxy_port).as_str(); + env_file += format!("\nhttp_proxy=127.0.0.1:{}", proxy_port).as_str(); // Save - fs::write("/etc/environment", env_file); + fs::write("/etc/environment", env_file).unwrap(); } #[cfg(macos)] diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 5a72302..ab2f160 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -130,6 +130,7 @@ pub fn set_migoto_target(path: String, migoto_path: String) -> bool { } } +#[cfg(windows)] #[tauri::command] pub fn wipe_registry(exec_name: String) { // Fetch the 'Internet Settings' registry key. @@ -152,6 +153,10 @@ pub fn wipe_registry(exec_name: String) { } } +#[cfg(unix)] +#[tauri::command] +pub fn wipe_registry(_exec_name: String) {} + #[cfg(windows)] #[tauri::command] pub fn is_elevated() -> bool {