mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2024-10-07 01:13:25 +00:00
fix compile issues
This commit is contained in:
parent
27122cd399
commit
d7783c5936
@ -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)]
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user