diff --git a/components/HeaderUserWidget.vue b/components/HeaderUserWidget.vue index dd9838f..26d44c4 100644 --- a/components/HeaderUserWidget.vue +++ b/components/HeaderUserWidget.vue @@ -49,17 +49,20 @@ Admin Dashboard - + + {{ nav.label }} + @@ -80,17 +83,17 @@ const open = ref(false); const router = useRouter(); router.afterEach(() => { open.value = false; -}) +}); const state = useAppState(); -const profilePictureUrl: string = await invoke("gen_drop_url", { - path: `/api/v1/object/${state.value.user?.profilePicture}`, -}); +const profilePictureUrl: string = await useObject( + state.value.user?.profilePicture ?? "" +); const adminUrl: string = await invoke("gen_drop_url", { path: "/admin", }); -function navigate(close: () => any, to: NavigationItem){ +function navigate(close: () => any, to: NavigationItem) { close(); router.push(to.route); } @@ -110,6 +113,6 @@ const navigation: NavigationItem[] = [ label: "Quit Drop", route: "/quit", prefix: "", - } -] + }, +]; diff --git a/components/InitiateAuthModule.vue b/components/InitiateAuthModule.vue index 1f9be6c..23f1900 100644 --- a/components/InitiateAuthModule.vue +++ b/components/InitiateAuthModule.vue @@ -126,6 +126,7 @@ import { invoke } from "@tauri-apps/api/core"; const loading = ref(false); const error = ref(); +let offerManualTimeout: NodeJS.Timeout | undefined; const offerManual = ref(false); const manualToken = ref(""); const manualLoading = ref(false); @@ -139,8 +140,9 @@ function authWrapper_wrapper() { auth().catch((e) => { loading.value = false; error.value = e; + if(offerManualTimeout) clearTimeout(offerManualTimeout); }); - setTimeout(() => { + offerManualTimeout = setTimeout(() => { offerManual.value = true; }, 10000); } diff --git a/src-tauri/src/games/downloads/download_agent.rs b/src-tauri/src/games/downloads/download_agent.rs index ef96a66..dce5043 100644 --- a/src-tauri/src/games/downloads/download_agent.rs +++ b/src-tauri/src/games/downloads/download_agent.rs @@ -250,6 +250,7 @@ impl GameDownloadAgent { let completed_indexes_loop_arc = completed_indexes.clone(); let contexts = self.contexts.lock().unwrap(); + debug!("{:#?}", contexts); pool.scope(|scope| { let client = &reqwest::blocking::Client::new(); for (index, context) in contexts.iter().enumerate() { diff --git a/src-tauri/src/process/process_manager.rs b/src-tauri/src/process/process_manager.rs index d9d4018..35b9f06 100644 --- a/src-tauri/src/process/process_manager.rs +++ b/src-tauri/src/process/process_manager.rs @@ -16,7 +16,8 @@ use umu_wrapper_lib::command_builder::UmuCommandBuilder; use crate::{ database::db::{ - borrow_db_mut_checked, ApplicationTransientStatus, GameDownloadStatus, GameVersion, DATA_ROOT_DIR + borrow_db_mut_checked, ApplicationTransientStatus, GameDownloadStatus, GameVersion, + DATA_ROOT_DIR, }, download_manager::downloadable_metadata::{DownloadType, DownloadableMetadata}, error::process_error::ProcessError, @@ -39,11 +40,14 @@ impl ProcessManager<'_> { drop(root_dir_lock); ProcessManager { - current_platform: if cfg!(windows) { - Platform::Windows - } else { - Platform::Linux - }, + #[cfg(target_os = "windows")] + current_platform: Platform::Windows, + + #[cfg(target_os = "macos")] + current_platform: Platform::macOS, + + #[cfg(target_os = "linux")] + current_platform: Platform::Linux, app_handle, processes: HashMap::new(), @@ -58,6 +62,10 @@ impl ProcessManager<'_> { (Platform::Linux, Platform::Linux), &NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static), ), + ( + (Platform::macOS, Platform::macOS), + &NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static), + ), ( (Platform::Linux, Platform::Windows), &UMULauncher {} as &(dyn ProcessHandler + Sync + Send + 'static), @@ -66,7 +74,11 @@ impl ProcessManager<'_> { } } - fn process_command(&self, install_dir: &String, command: Vec) -> (PathBuf, Vec) { + fn process_command( + &self, + install_dir: &String, + command: Vec, + ) -> (PathBuf, Vec) { let root = &command[0]; let install_dir = Path::new(install_dir); @@ -198,7 +210,6 @@ impl ProcessManager<'_> { _ => return Err(ProcessError::NotDownloaded), }; - let game_version = db_lock .applications .game_versions @@ -216,14 +227,14 @@ impl ProcessManager<'_> { } => { command.extend([game_version.launch_command.clone()]); command.extend(game_version.launch_args.clone()); - }, + } GameDownloadStatus::SetupRequired { version_name: _, install_dir: _, } => { command.extend([game_version.setup_command.clone()]); command.extend(game_version.setup_args.clone()); - }, + } _ => panic!("unreachable code"), }; info!("Command: {:?}", &command); @@ -326,6 +337,7 @@ impl ProcessManager<'_> { pub enum Platform { Windows, Linux, + macOS, } pub trait ProcessHandler: Send + 'static { @@ -374,8 +386,11 @@ impl ProcessHandler for UMULauncher { ) -> Result { debug!("Game override: \"{:?}\"", &game_version.umu_id_override); let game_id = match &game_version.umu_id_override { - Some(game_override) => game_override.is_empty().then_some(game_version.game_id.clone()).unwrap_or(game_override.clone()) , - None => game_version.game_id.clone() + Some(game_override) => game_override + .is_empty() + .then_some(game_version.game_id.clone()) + .unwrap_or(game_override.clone()), + None => game_version.game_id.clone(), }; info!("Game ID: {}", game_id); UmuCommandBuilder::new(UMU_LAUNCHER_EXECUTABLE, launch_command)