From 3f18d15d395ef28519bccf18ed04dac993cab6fe Mon Sep 17 00:00:00 2001 From: DecDuck Date: Sun, 7 Sep 2025 15:57:06 +1000 Subject: [PATCH] Collections & download stability, UI (#130) * feat: different local path in dev #73 * feat: better error output for downloads * feat: collections in library view * feat: improve download manager reliability * feat: new download UI, more stable downloads * fix: clippy * fix: only show admin link if user is admin * feat: check for libs before building --- build.mjs | 7 + main/app.vue | 2 +- main/components/HeaderUserWidget.vue | 2 +- main/components/LibrarySearch.vue | 239 +++++++++++++----- main/components/LoadingIndicator.vue | 7 - main/composables/downloads.ts | 2 + main/pages/queue.vue | 34 +-- main/types.ts | 7 + src-tauri/Cargo.lock | 7 +- src-tauri/Cargo.toml | 13 +- src-tauri/src/database/db.rs | 7 +- src-tauri/src/database/models.rs | 27 +- src-tauri/src/database/scan.rs | 4 +- .../download_manager_builder.rs | 88 +++---- .../download_manager_frontend.rs | 2 +- .../src/download_manager/downloadable.rs | 8 +- .../download_manager/util/progress_object.rs | 12 +- .../util/rolling_progress_updates.rs | 13 +- src-tauri/src/games/collections/collection.rs | 5 +- src-tauri/src/games/collections/commands.rs | 20 +- src-tauri/src/games/commands.rs | 4 +- .../src/games/downloads/download_agent.rs | 43 +++- .../src/games/downloads/download_logic.rs | 37 ++- src-tauri/src/games/library.rs | 14 +- src-tauri/src/games/state.rs | 18 +- src-tauri/src/remote/auth.rs | 5 +- src-tauri/src/remote/cache.rs | 17 ++ 27 files changed, 449 insertions(+), 195 deletions(-) delete mode 100644 main/components/LoadingIndicator.vue diff --git a/build.mjs b/build.mjs index c4846f1..051b850 100644 --- a/build.mjs +++ b/build.mjs @@ -21,6 +21,13 @@ async function spawn(exec, opts) { }); } +const expectedLibs = ["drop-base/package.json"]; + +for (const lib of expectedLibs) { + const path = `./libs/${lib}`; + if (!fs.existsSync(path)) throw `Missing "${expectedLibs}". Run "git submodule update --init --recursive"`; +} + const views = fs.readdirSync(".").filter((view) => { const expectedPath = `./${view}/package.json`; return fs.existsSync(expectedPath); diff --git a/main/app.vue b/main/app.vue index 7d4165f..1594dd6 100644 --- a/main/app.vue +++ b/main/app.vue @@ -1,5 +1,5 @@ diff --git a/main/composables/downloads.ts b/main/composables/downloads.ts index d75c46f..f9ab1cd 100644 --- a/main/composables/downloads.ts +++ b/main/composables/downloads.ts @@ -32,3 +32,5 @@ listen("update_stats", (event) => { const stats = useStatsState(); stats.value = event.payload as StatsState; }); + +export const useDownloadHistory = () => useState>('history', () => []); \ No newline at end of file diff --git a/main/pages/queue.vue b/main/pages/queue.vue index 8d5c4ef..30eb886 100644 --- a/main/pages/queue.vue +++ b/main/pages/queue.vue @@ -4,18 +4,18 @@ class="h-16 overflow-hidden relative rounded-xl flex flex-row border border-zinc-900" >
- {{ formatKilobytes(stats.speed) }}/s - {{ formatKilobytes(stats.speed) }}B/s + {{ formatTime(stats.time) }} left
-
+
@@ -62,9 +62,9 @@ class="mt-2 inline-flex items-center gap-x-1 text-zinc-400 text-sm font-display" >{{ formatKilobytes(element.current / 1000) - }} + }}B / - {{ formatKilobytes(element.max / 1000) }}{{ formatKilobytes(element.max / 1000) }}B
@@ -91,7 +91,7 @@