mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 15:14:35 +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);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn reopen_as_admin() {}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn reopen_as_admin() {}
|
||||
|
||||
@@ -11,14 +11,16 @@ use proxy::set_proxy_addr;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::{collections::HashMap, sync::Mutex};
|
||||
use system_helpers::is_elevated;
|
||||
use tauri::api::path::data_dir;
|
||||
use tauri::async_runtime::block_on;
|
||||
|
||||
use std::thread;
|
||||
use sysinfo::{Pid, ProcessExt, System, SystemExt};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::admin::reopen_as_admin;
|
||||
#[cfg(target_os = "windows")]
|
||||
use system_helpers::is_elevated;
|
||||
|
||||
mod admin;
|
||||
mod config;
|
||||
@@ -157,6 +159,7 @@ fn main() -> Result<(), ArgsError> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
let parsed_args = block_on(parse_args(&args)).unwrap();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
if !is_elevated() && !parsed_args.value_of("no-admin")? {
|
||||
println!("===============================================================================");
|
||||
println!("You running as a non-elevated user. Some stuff will almost definitely not work.");
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
*/
|
||||
|
||||
use crate::config::get_config;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::system_helpers::run_command;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{path::PathBuf, str::FromStr, sync::Mutex};
|
||||
@@ -449,19 +447,9 @@ pub fn install_ca_files(cert_path: &Path) {
|
||||
println!("Installed certificate.");
|
||||
}
|
||||
|
||||
// If this is borked on non-debian platforms, so be it
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn install_ca_files(cert_path: &Path) {
|
||||
let usr_certs = PathBuf::from("/usr/local/share/ca-certificates");
|
||||
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.");
|
||||
pub fn install_ca_files(_cert_path: &Path) {
|
||||
println!("install_ca_files is not implemented");
|
||||
}
|
||||
|
||||
#[cfg(not(any(windows, target_os = "macos", target_os = "linux")))]
|
||||
|
||||
Reference in New Issue
Block a user