diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0f1aae1..1cbc020 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -27,9 +27,10 @@ lazy_static! { } fn main() { + // Start the game process watcher. process_watcher(); - // Make BG folder if it doesn't exist + // Make BG folder if it doesn't exist. let bg_folder = format!("{}/bg", system_helpers::install_location()); if !std::path::Path::new(&bg_folder).exists() { std::fs::create_dir_all(&bg_folder).unwrap(); @@ -51,6 +52,7 @@ fn main() { system_helpers::open_in_browser, system_helpers::copy_file, system_helpers::install_location, + system_helpers::is_elevated, proxy::set_proxy_addr, proxy::generate_ca_files, unzip::unzip, @@ -73,17 +75,17 @@ fn process_watcher() { // Start a thread so as to not block the main thread. thread::spawn(|| { - let mut s = System::new_all(); + let mut system = System::new_all(); loop { // Refresh system info - s.refresh_all(); + system.refresh_all(); // Grab the game process name let proc = WATCH_GAME_PROCESS.lock().unwrap().to_string(); if !&proc.is_empty() { - let proc_with_name = s.processes_by_exact_name(&proc); + let proc_with_name = system.processes_by_exact_name(&proc); let mut exists = false; for _p in proc_with_name { @@ -107,7 +109,7 @@ fn is_game_running() -> bool { // Grab the game process name let proc = WATCH_GAME_PROCESS.lock().unwrap().to_string(); - return !&proc.is_empty(); + return !proc.is_empty(); } #[tauri::command] @@ -146,8 +148,8 @@ async fn req_get(url: String) -> String { } #[tauri::command] -async fn get_theme_list(dataDir: String) -> Vec> { - let theme_loc = format!("{}/themes", dataDir); +async fn get_theme_list(data_dir: String) -> Vec> { + let theme_loc = format!("{}/themes", data_dir); // Ensure folder exists if !std::path::Path::new(&theme_loc).exists() { diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 5d608c2..56f7843 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -85,4 +85,9 @@ pub fn install_location() -> String { exe_path.pop(); return exe_path.to_str().unwrap().to_string(); +} + +#[tauri::command] +pub fn is_elevated() -> bool { + return is_elevated::is_elevated(); } \ No newline at end of file diff --git a/src/ui/Test.tsx b/src/ui/Debug.tsx similarity index 70% rename from src/ui/Test.tsx rename to src/ui/Debug.tsx index dd01349..845574e 100644 --- a/src/ui/Test.tsx +++ b/src/ui/Debug.tsx @@ -18,11 +18,19 @@ async function generateCertificates() { await invoke('generate_ca_files', { path: await dataDir() + '\\cultivation' }) } +async function generateCertInfo() { + console.log({ + certificatePath: await dataDir() + '\\cultivation\\ca', + isAdmin: await invoke('is_elevated') + }) + alert('check your dev console and send that in #cultivation') +} + function none() { alert('none') } -class Test extends React.Component{ +class Debug extends React.Component{ render() { return (
@@ -30,9 +38,10 @@ class Test extends React.Component{ +
) } } -export default Test \ No newline at end of file +export default Debug \ No newline at end of file