mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 15:14:35 +01:00
fix compile issues
This commit is contained in:
@@ -75,6 +75,8 @@ impl HttpHandler for ProxyHandler {
|
|||||||
* Starts an HTTP(S) proxy server.
|
* Starts an HTTP(S) proxy server.
|
||||||
*/
|
*/
|
||||||
pub async fn create_proxy(proxy_port: u16, certificate_path: String) {
|
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.
|
// Get the certificate and private key.
|
||||||
let mut private_key_bytes: &[u8] =
|
let mut private_key_bytes: &[u8] =
|
||||||
&fs::read(format!("{}\\private.key", certificate_path)).expect("Could not read private key");
|
&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") {
|
let mut env_file = match fs::read_to_string("/etc/environment") {
|
||||||
Ok(f) => f,
|
Ok(f) => f,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error opening /etc/environment: {}", e)
|
println!("Error opening /etc/environment: {}", e);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Append the proxy configuration.
|
// 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
|
// 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!("\nhttps_proxy=127.0.0.1:{}", proxy_port).as_str();
|
||||||
env_file += format!("\nhttp_proxy=127.0.0.1:{}", proxy_port);
|
env_file += format!("\nhttp_proxy=127.0.0.1:{}", proxy_port).as_str();
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
fs::write("/etc/environment", env_file);
|
fs::write("/etc/environment", env_file).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(macos)]
|
#[cfg(macos)]
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ pub fn set_migoto_target(path: String, migoto_path: String) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn wipe_registry(exec_name: String) {
|
pub fn wipe_registry(exec_name: String) {
|
||||||
// Fetch the 'Internet Settings' registry key.
|
// 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)]
|
#[cfg(windows)]
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn is_elevated() -> bool {
|
pub fn is_elevated() -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user