mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-15 01:01:25 +10:00
fix: macos and ui
This commit is contained in:
@ -49,17 +49,20 @@
|
||||
Admin Dashboard
|
||||
</a>
|
||||
</MenuItem>
|
||||
<MenuItem v-for="(nav, navIdx) in navigation" v-slot="{ active, close }">
|
||||
<MenuItem
|
||||
v-for="(nav, navIdx) in navigation"
|
||||
v-slot="{ active, close }"
|
||||
>
|
||||
<button
|
||||
@click="() => navigate(close, nav)"
|
||||
@click="() => navigate(close, nav)"
|
||||
:href="nav.route"
|
||||
:class="[
|
||||
active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400',
|
||||
'transition text-left block px-4 py-2 text-sm',
|
||||
]"
|
||||
>
|
||||
{{ nav.label }}</button
|
||||
>
|
||||
{{ nav.label }}
|
||||
</button>
|
||||
</MenuItem>
|
||||
</div>
|
||||
</PanelWidget>
|
||||
@ -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: "",
|
||||
}
|
||||
]
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
@ -126,6 +126,7 @@ import { invoke } from "@tauri-apps/api/core";
|
||||
const loading = ref(false);
|
||||
const error = ref<string | undefined>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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<String>) -> (PathBuf, Vec<String>) {
|
||||
fn process_command(
|
||||
&self,
|
||||
install_dir: &String,
|
||||
command: Vec<String>,
|
||||
) -> (PathBuf, Vec<String>) {
|
||||
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<Child, Error> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user