mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-04 09:25:16 +01:00
Removed root requirement
Also disabled install_ca_files since this causes crashes when not run as root
This commit is contained in:
@@ -18,8 +18,5 @@ pub fn reopen_as_admin() {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
pub fn reopen_as_admin() {}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub fn reopen_as_admin() {}
|
pub fn reopen_as_admin() {}
|
||||||
|
|||||||
@@ -11,14 +11,16 @@ use proxy::set_proxy_addr;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::{collections::HashMap, sync::Mutex};
|
use std::{collections::HashMap, sync::Mutex};
|
||||||
use system_helpers::is_elevated;
|
|
||||||
use tauri::api::path::data_dir;
|
use tauri::api::path::data_dir;
|
||||||
use tauri::async_runtime::block_on;
|
use tauri::async_runtime::block_on;
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use sysinfo::{Pid, ProcessExt, System, SystemExt};
|
use sysinfo::{Pid, ProcessExt, System, SystemExt};
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use crate::admin::reopen_as_admin;
|
use crate::admin::reopen_as_admin;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
use system_helpers::is_elevated;
|
||||||
|
|
||||||
mod admin;
|
mod admin;
|
||||||
mod config;
|
mod config;
|
||||||
@@ -157,6 +159,7 @@ fn main() -> Result<(), ArgsError> {
|
|||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let parsed_args = block_on(parse_args(&args)).unwrap();
|
let parsed_args = block_on(parse_args(&args)).unwrap();
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
if !is_elevated() && !parsed_args.value_of("no-admin")? {
|
if !is_elevated() && !parsed_args.value_of("no-admin")? {
|
||||||
println!("===============================================================================");
|
println!("===============================================================================");
|
||||||
println!("You running as a non-elevated user. Some stuff will almost definitely not work.");
|
println!("You running as a non-elevated user. Some stuff will almost definitely not work.");
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::config::get_config;
|
use crate::config::get_config;
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
use crate::system_helpers::run_command;
|
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use std::{path::PathBuf, str::FromStr, sync::Mutex};
|
use std::{path::PathBuf, str::FromStr, sync::Mutex};
|
||||||
@@ -449,19 +447,9 @@ pub fn install_ca_files(cert_path: &Path) {
|
|||||||
println!("Installed certificate.");
|
println!("Installed certificate.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is borked on non-debian platforms, so be it
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn install_ca_files(cert_path: &Path) {
|
pub fn install_ca_files(_cert_path: &Path) {
|
||||||
let usr_certs = PathBuf::from("/usr/local/share/ca-certificates");
|
println!("install_ca_files is not implemented");
|
||||||
let usr_cert_path = usr_certs.join("cultivation.crt");
|
|
||||||
|
|
||||||
// Create dir if it doesn't exist
|
|
||||||
fs::create_dir_all(&usr_certs).expect("Unable to create local certificate directory");
|
|
||||||
|
|
||||||
fs::copy(cert_path, usr_cert_path).expect("Unable to copy cert to local certificate directory");
|
|
||||||
run_command("update-ca-certificates", vec![], None);
|
|
||||||
|
|
||||||
println!("Installed certificate.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(windows, target_os = "macos", target_os = "linux")))]
|
#[cfg(not(any(windows, target_os = "macos", target_os = "linux")))]
|
||||||
|
|||||||
Reference in New Issue
Block a user