From 949acfc161831d6d0607ebe532b39b5bab820ac4 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 13:07:10 +1100 Subject: [PATCH 001/210] feat(auth): offer manual signin --- components/InitiateAuthModule.vue | 47 +++++++++++++++++++++++++++++++ src-tauri/src/auth.rs | 11 +++++--- src-tauri/src/lib.rs | 20 ++++++++----- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/components/InitiateAuthModule.vue b/components/InitiateAuthModule.vue index 5f7158c..1f9be6c 100644 --- a/components/InitiateAuthModule.vue +++ b/components/InitiateAuthModule.vue @@ -42,6 +42,31 @@ +
+

Having trouble?

+

+ You can manually enter the token from your web browser. +

+
+ + + Submit + +
+
+
@@ -101,6 +126,10 @@ import { invoke } from "@tauri-apps/api/core"; const loading = ref(false); const error = ref(); +const offerManual = ref(false); +const manualToken = ref(""); +const manualLoading = ref(false); + async function auth() { await invoke("auth_initiate"); } @@ -111,5 +140,23 @@ function authWrapper_wrapper() { loading.value = false; error.value = e; }); + setTimeout(() => { + offerManual.value = true; + }, 10000); +} + +async function continueManual() { + await invoke("manual_recieve_handshake", { token: manualToken.value }); +} + +function continueManual_wrapper() { + loading.value = true; + continueManual() + .catch((e) => { + error.value = e; + }) + .finally(() => { + loading.value = false; + }); } diff --git a/src-tauri/src/auth.rs b/src-tauri/src/auth.rs index 9d6afb5..24c8b57 100644 --- a/src-tauri/src/auth.rs +++ b/src-tauri/src/auth.rs @@ -1,7 +1,4 @@ -use std::{ - env, - sync::Mutex, -}; +use std::{env, sync::Mutex}; use chrono::Utc; use log::{info, warn}; @@ -138,6 +135,12 @@ fn recieve_handshake_logic(app: &AppHandle, path: String) -> Result<(), RemoteAc Ok(()) } +#[tauri::command] +pub fn manual_recieve_handshake(app: AppHandle, token: String) -> Result<(), String> { + recieve_handshake(app, format!("handshake/{}", token)); + Ok(()) +} + pub fn recieve_handshake(app: AppHandle, path: String) { // Tell the app we're processing app.emit("auth/processing", ()).unwrap(); diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b81130a..dfaa542 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -11,7 +11,7 @@ mod state; mod tests; use crate::db::DatabaseImpls; -use auth::{auth_initiate, generate_authorization_header, recieve_handshake, retry_connect}; +use auth::{auth_initiate, generate_authorization_header, manual_recieve_handshake, recieve_handshake, retry_connect}; use cleanup::{cleanup_and_exit, quit}; use db::{ add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus, @@ -213,6 +213,7 @@ pub fn run() { // Auth auth_initiate, retry_connect, + manual_recieve_handshake, // Remote use_remote, gen_drop_url, @@ -269,6 +270,7 @@ pub fn run() { info!("handling drop:// url"); let binding = event.urls(); let url = binding.first().unwrap(); + return; // We're macOS if url.host_str().unwrap() == "handshake" { recieve_handshake(handle.clone(), url.path().to_string()) } @@ -345,16 +347,20 @@ pub fn run() { responder.respond(resp); }) - .on_window_event(|window, event| if let WindowEvent::CloseRequested { api, .. } = event { - window.hide().unwrap(); - api.prevent_close(); + .on_window_event(|window, event| { + if let WindowEvent::CloseRequested { api, .. } = event { + window.hide().unwrap(); + api.prevent_close(); + } }) .build(tauri::generate_context!()) .expect("error while running tauri application"); - app.run(|app_handle, event| if let RunEvent::ExitRequested { code, api, .. } = event { - if code.is_none() { - api.prevent_exit(); + app.run(|app_handle, event| { + if let RunEvent::ExitRequested { code, api, .. } = event { + if code.is_none() { + api.prevent_exit(); + } } }); } From 139bc0ca36aadf1d85a363e7a344780ee3527e35 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 14:03:06 +1100 Subject: [PATCH 002/210] feat(install modal): add note about more install dirs --- components/PageWidget.vue | 7 + pages/library/[id]/index.vue | 498 +++++++++++++++-------------------- 2 files changed, 226 insertions(+), 279 deletions(-) create mode 100644 components/PageWidget.vue diff --git a/components/PageWidget.vue b/components/PageWidget.vue new file mode 100644 index 0000000..ad9428b --- /dev/null +++ b/components/PageWidget.vue @@ -0,0 +1,7 @@ + diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index 4cc2e7e..2588a04 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -39,285 +39,221 @@
- - - -
- - -
-
- -
-
-
-
- Install {{ game.mName }}? - -
-

- Drop will add {{ game.mName }} to the queue to be - downloaded. While downloading, Drop may use up a large - amount of resources, particularly network bandwidth and - CPU utilisation. -

-
-
-
- -
-
- - Version -
- - {{ - versionOptions[installVersionIndex].versionName - }} - on - {{ - versionOptions[installVersionIndex].platform - }} - - - - - - - -
  • - {{ version.versionName }} on - {{ version.platform }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - There are no supported versions to install. Please - contact your server admin or try again later. -

    -
    -
    -
    -
    - - Install to -
    - - {{ - installDirs[installDir] - }} - - - - - - - -
  • - {{ dir }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -

    - {{ installError }} -

    -
    -
    -
    -
    -
    - - Install - - -
    -
    -
    + + + + From e72662c4a8892fefbf759ad31d680d9c9c6a3782 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 14:04:55 +1100 Subject: [PATCH 003/210] fix(install flow): clear stale data before requesting new --- pages/library/[id]/index.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index 2588a04..db75439 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -297,6 +297,8 @@ const versionOptions = ref< const installDirs = ref>(); async function installFlow() { installFlowOpen.value = true; + versionOptions.value = undefined; + installDirs.value = undefined try { versionOptions.value = await invoke("fetch_game_verion_options", { From c722a54132d5e6212dd20baee8445cfbd5220d24 Mon Sep 17 00:00:00 2001 From: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:39:50 +1030 Subject: [PATCH 004/210] Delete pages/library.vue --- pages/library.vue | 59 ----------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 pages/library.vue diff --git a/pages/library.vue b/pages/library.vue deleted file mode 100644 index 8acd519..0000000 --- a/pages/library.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - From dcb2c0f004af36009c05656b06e5a55ab22d4e9d Mon Sep 17 00:00:00 2001 From: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:40:24 +1030 Subject: [PATCH 005/210] Add files via upload --- pages/library.vue | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pages/library.vue diff --git a/pages/library.vue b/pages/library.vue new file mode 100644 index 0000000..a1838d9 --- /dev/null +++ b/pages/library.vue @@ -0,0 +1,52 @@ + + + From a881d8e248542df58201613e5203cb5bf569df5d Mon Sep 17 00:00:00 2001 From: seethruhead Date: Thu, 26 Dec 2024 22:16:50 -0500 Subject: [PATCH 006/210] adds nvm rc! --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..4099407 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +23 From f4ac1c87cdb945a594c688def8bd90fcbeebdb9e Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 14:03:06 +1100 Subject: [PATCH 007/210] feat(install modal): add note about more install dirs --- components/PageWidget.vue | 7 + pages/library/[id]/index.vue | 498 +++++++++++++++-------------------- 2 files changed, 226 insertions(+), 279 deletions(-) create mode 100644 components/PageWidget.vue diff --git a/components/PageWidget.vue b/components/PageWidget.vue new file mode 100644 index 0000000..ad9428b --- /dev/null +++ b/components/PageWidget.vue @@ -0,0 +1,7 @@ + diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index 4cc2e7e..2588a04 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -39,285 +39,221 @@
    - - - -
    - - -
    -
    - -
    -
    -
    -
    - Install {{ game.mName }}? - -
    -

    - Drop will add {{ game.mName }} to the queue to be - downloaded. While downloading, Drop may use up a large - amount of resources, particularly network bandwidth and - CPU utilisation. -

    -
    -
    -
    - -
    -
    - - Version -
    - - {{ - versionOptions[installVersionIndex].versionName - }} - on - {{ - versionOptions[installVersionIndex].platform - }} - - - - - - - -
  • - {{ version.versionName }} on - {{ version.platform }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - There are no supported versions to install. Please - contact your server admin or try again later. -

    -
    -
    -
    -
    - - Install to -
    - - {{ - installDirs[installDir] - }} - - - - - - - -
  • - {{ dir }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -

    - {{ installError }} -

    -
    -
    -
    -
    -
    - - Install - - -
    -
    -
    + + + + From 327628b78016fec7e1dab450ddd0817a88d2163b Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 14:04:55 +1100 Subject: [PATCH 008/210] fix(install flow): clear stale data before requesting new --- pages/library/[id]/index.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index 2588a04..db75439 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -297,6 +297,8 @@ const versionOptions = ref< const installDirs = ref>(); async function installFlow() { installFlowOpen.value = true; + versionOptions.value = undefined; + installDirs.value = undefined try { versionOptions.value = await invoke("fetch_game_verion_options", { From 1861659daab9f22cb54948c39f6d358ac5298e50 Mon Sep 17 00:00:00 2001 From: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:39:50 +1030 Subject: [PATCH 009/210] Delete pages/library.vue --- pages/library.vue | 59 ----------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 pages/library.vue diff --git a/pages/library.vue b/pages/library.vue deleted file mode 100644 index 8acd519..0000000 --- a/pages/library.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - From 93b8b83c20024c5c54ef1252e23edee079a3f4aa Mon Sep 17 00:00:00 2001 From: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:40:24 +1030 Subject: [PATCH 010/210] Add files via upload --- pages/library.vue | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pages/library.vue diff --git a/pages/library.vue b/pages/library.vue new file mode 100644 index 0000000..a1838d9 --- /dev/null +++ b/pages/library.vue @@ -0,0 +1,52 @@ + + + From d7b0302bdde84296d6b9d1dcd8002eaa93789524 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 16:33:04 +1100 Subject: [PATCH 011/210] fix(library page): fix install button --- pages/library/[id]/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index db75439..5d828bf 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -56,7 +56,7 @@
    -
    +
    + + diff --git a/src-tauri/src/debug.rs b/src-tauri/src/debug.rs new file mode 100644 index 0000000..de42dd6 --- /dev/null +++ b/src-tauri/src/debug.rs @@ -0,0 +1,23 @@ +use crate::{DATA_ROOT_DIR, DB}; +use serde::Serialize; + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SystemData { + client_id: String, + base_url: String, + data_dir: String, +} + +#[tauri::command] +pub fn fetch_system_data() -> Result { + let db_handle = DB.borrow_data().map_err(|e| e.to_string())?; + let system_data = SystemData { + client_id: db_handle.auth.as_ref().unwrap().client_id.clone(), + base_url: db_handle.base_url.clone(), + data_dir: DATA_ROOT_DIR.lock().unwrap().to_string_lossy().to_string(), + }; + drop(db_handle); + + Ok(system_data) +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 2d41174..b7abcfe 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -3,21 +3,27 @@ mod db; mod downloads; mod library; +mod autostart; mod cleanup; +mod debug; mod process; mod remote; mod state; #[cfg(test)] mod tests; -mod autostart; +use crate::autostart::{get_autostart_enabled, toggle_autostart}; use crate::db::DatabaseImpls; -use auth::{auth_initiate, generate_authorization_header, manual_recieve_handshake, recieve_handshake, retry_connect, sign_out}; +use auth::{ + auth_initiate, generate_authorization_header, manual_recieve_handshake, recieve_handshake, + retry_connect, sign_out, +}; use cleanup::{cleanup_and_exit, quit}; use db::{ add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus, DATA_ROOT_DIR, }; +use debug::fetch_system_data; use downloads::download_commands::*; use downloads::download_manager::DownloadManager; use downloads::download_manager_builder::DownloadManagerBuilder; @@ -47,7 +53,6 @@ use tauri::menu::{Menu, MenuItem, PredefinedMenuItem}; use tauri::tray::TrayIconBuilder; use tauri::{AppHandle, Manager, RunEvent, WindowEvent}; use tauri_plugin_deep_link::DeepLinkExt; -use crate::autostart::{get_autostart_enabled, toggle_autostart}; #[derive(Clone, Copy, Serialize)] pub enum AppStatus { @@ -217,6 +222,7 @@ pub fn run() { // Core utils fetch_state, quit, + fetch_system_data, // Auth auth_initiate, retry_connect, @@ -250,7 +256,7 @@ pub fn run() { .plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_autostart::init( tauri_plugin_autostart::MacosLauncher::LaunchAgent, - Some(vec!["--minimize"]) + Some(vec!["--minimize"]), )) .setup(|app| { let handle = app.handle().clone(); From 2c8164e54f22c15a70f6e9f9ea2ae4d460171a15 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Sun, 5 Jan 2025 18:32:22 +1100 Subject: [PATCH 022/210] feat(library ui): add installed ui in the library menu --- composables/game.ts | 2 +- pages/library.vue | 40 +++++++++++++++++++++++++++------------- src-tauri/src/state.rs | 10 +++++++--- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/composables/game.ts b/composables/game.ts index 7f28435..c2ffc0c 100644 --- a/composables/game.ts +++ b/composables/game.ts @@ -12,7 +12,7 @@ export type SerializedGameStatus = [ OptionGameStatus | null ]; -const parseStatus = (status: SerializedGameStatus): GameStatus => { +export const parseStatus = (status: SerializedGameStatus): GameStatus => { if (status[0]) { return { type: status[0].type, diff --git a/pages/library.vue b/pages/library.vue index a1838d9..925addb 100644 --- a/pages/library.vue +++ b/pages/library.vue @@ -1,21 +1,25 @@ + \ No newline at end of file diff --git a/src-tauri/src/games/library.rs b/src-tauri/src/games/library.rs index b2f2fe2..4eda534 100644 --- a/src-tauri/src/games/library.rs +++ b/src-tauri/src/games/library.rs @@ -36,6 +36,7 @@ pub struct Game { m_banner_id: String, m_cover_id: String, m_image_library: Vec, + m_image_carousel: Vec, } #[derive(serde::Serialize, Clone)] pub struct GameUpdateEvent { diff --git a/types.ts b/types.ts index 60a5b23..0533cfd 100644 --- a/types.ts +++ b/types.ts @@ -34,6 +34,7 @@ export type Game = { mBannerId: string; mCoverId: string; mImageLibrary: string[]; + mImageCarousel: string[]; }; export enum AppStatus { From 639d3b4630c3f42659fc3b43afe25430bdd31fd8 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Thu, 20 Feb 2025 21:19:54 +1100 Subject: [PATCH 119/210] fix: refactoring and error handling --- components/LibrarySearch.vue | 157 +++++++++++----------- error.vue | 89 +++++++++++++ layouts/default.vue | 77 ++++++++++- layouts/mini.vue | 2 +- package.json | 1 + pages/error/index.vue | 66 ---------- pages/library.vue | 27 +++- pages/library/[id]/index.vue | 167 ++++++++++++------------ pages/library/index.vue | 11 +- pages/store/index.vue | 3 +- plugins/global-error-handler.ts | 3 + yarn.lock | 222 +++++++++++++++++++++++++++++++- 12 files changed, 577 insertions(+), 248 deletions(-) create mode 100644 error.vue delete mode 100644 pages/error/index.vue diff --git a/components/LibrarySearch.vue b/components/LibrarySearch.vue index a73542e..14399bf 100644 --- a/components/LibrarySearch.vue +++ b/components/LibrarySearch.vue @@ -1,7 +1,11 @@ \ No newline at end of file + diff --git a/error.vue b/error.vue new file mode 100644 index 0000000..c8de2f7 --- /dev/null +++ b/error.vue @@ -0,0 +1,89 @@ + + + diff --git a/layouts/default.vue b/layouts/default.vue index 025a7cf..b46858d 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -1,9 +1,76 @@ diff --git a/layouts/mini.vue b/layouts/mini.vue index 4519a77..31aa140 100644 --- a/layouts/mini.vue +++ b/layouts/mini.vue @@ -1,5 +1,5 @@ - +