From 924e4e334c980d2dd8deaedf35b18f785b872530 Mon Sep 17 00:00:00 2001 From: quexeky <116044207+quexeky@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:22:22 +1000 Subject: [PATCH 01/40] Database not being properly serialised with rpm_serde (#48) Signed-off-by: quexeky --- src-tauri/src/database/db.rs | 7 ++++--- src-tauri/src/database/models.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src-tauri/src/database/db.rs b/src-tauri/src/database/db.rs index 3b54c69..3b72e36 100644 --- a/src-tauri/src/database/db.rs +++ b/src-tauri/src/database/db.rs @@ -6,6 +6,7 @@ use std::{ use chrono::Utc; use log::{debug, error, info, warn}; +use native_model::{Decode, Encode}; use rustbreak::{DeSerError, DeSerializer, PathDatabase, RustbreakError}; use serde::{de::DeserializeOwned, Serialize}; use url::Url; @@ -26,15 +27,15 @@ impl DeSerializer for DropDatabaseSerializer { fn serialize(&self, val: &T) -> rustbreak::error::DeSerResult> { - native_model::encode(val).map_err(|e| DeSerError::Internal(e.to_string())) + native_model::rmp_serde_1_3::RmpSerde::encode(val).map_err(|e| DeSerError::Internal(e.to_string())) } fn deserialize(&self, mut s: R) -> rustbreak::error::DeSerResult { let mut buf = Vec::new(); s.read_to_end(&mut buf) .map_err(|e| rustbreak::error::DeSerError::Other(e.into()))?; - let (val, _version) = - native_model::decode::(buf).map_err(|e| DeSerError::Internal(e.to_string()))?; + let val = + native_model::rmp_serde_1_3::RmpSerde::decode(buf).map_err(|e| DeSerError::Internal(e.to_string()))?; Ok(val) } } diff --git a/src-tauri/src/database/models.rs b/src-tauri/src/database/models.rs index 273e25d..45a7f51 100644 --- a/src-tauri/src/database/models.rs +++ b/src-tauri/src/database/models.rs @@ -27,7 +27,7 @@ pub mod data { #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] - #[native_model(id = 2, version = 1)] + #[native_model(id = 2, version = 1, with = native_model::rmp_serde_1_3::RmpSerde)] pub struct GameVersion { pub game_id: String, pub version_name: String, @@ -69,7 +69,7 @@ pub mod data { #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] - #[native_model(id = 4, version = 1)] + #[native_model(id = 4, version = 1, with = native_model::rmp_serde_1_3::RmpSerde)] pub struct Settings { pub autostart: bool, pub max_download_threads: usize, @@ -88,7 +88,7 @@ pub mod data { // Strings are version names for a particular game #[derive(Serialize, Clone, Deserialize)] #[serde(tag = "type")] - #[native_model(id = 5, version = 1)] + #[native_model(id = 5, version = 1, with = native_model::rmp_serde_1_3::RmpSerde)] pub enum GameDownloadStatus { Remote {}, SetupRequired { @@ -111,7 +111,7 @@ pub mod data { } #[derive(serde::Serialize, Clone, Deserialize)] - #[native_model(id = 6, version = 1)] + #[native_model(id = 6, version = 1, with = native_model::rmp_serde_1_3::RmpSerde)] pub struct DatabaseAuth { pub private: String, pub cert: String, @@ -130,7 +130,7 @@ pub mod data { Mod, } - #[native_model(id = 7, version = 1)] + #[native_model(id = 7, version = 1, with = native_model::rmp_serde_1_3::RmpSerde)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct DownloadableMetadata { @@ -168,7 +168,7 @@ pub mod data { use super::*; - #[native_model(id = 1, version = 2)] + #[native_model(id = 1, version = 2, with = native_model::rmp_serde_1_3::RmpSerde)] #[derive(Serialize, Deserialize, Clone, Default)] pub struct Database { #[serde(default)] @@ -182,7 +182,7 @@ pub mod data { pub compat_info: Option, } - #[native_model(id = 8, version = 2)] + #[native_model(id = 8, version = 2, with = native_model::rmp_serde_1_3::RmpSerde)] #[derive(Serialize, Deserialize, Clone, Default)] pub struct DatabaseCompatInfo { From 86bce1c68d61d30662d98c121026dc4cfc401a96 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 6 Jun 2025 09:25:44 +1000 Subject: [PATCH 02/40] Release: v0.3.0-rc-3 (#51) --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 6748cc3..9cec3e6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "drop-app", "private": true, - "version": "0.3.0-rc-2", + "version": "0.3.0-rc-3", "type": "module", "scripts": { "build": "nuxt build", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 5b24471..77755ee 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "drop-app" -version = "0.3.0-rc-2" +version = "0.3.0-rc-3" dependencies = [ "atomic-instant-full", "boxcar", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 41eaabb..5faba5e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drop-app" -version = "0.3.0-rc-2" +version = "0.3.0-rc-3" description = "The client application for the open-source, self-hosted game distribution platform Drop" authors = ["Drop OSS"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1bf3043..daf149f 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2.0.0", "productName": "Drop Desktop Client", - "version": "0.3.0-rc-2", + "version": "0.3.0-rc-3", "identifier": "dev.drop.app", "build": { "beforeDevCommand": "yarn dev --port 1432", From 0ce55e12c56eb5dda278b2da65bab5b6d89a0302 Mon Sep 17 00:00:00 2001 From: quexeky <116044207+quexeky@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:09:44 +1000 Subject: [PATCH 03/40] fix: Re-update the user and app status when recieve_handshake is called (#54) Also enabled assetProtocol for better caching in general Signed-off-by: quexeky --- composables/state-navigation.ts | 5 ++++- src-tauri/Cargo.lock | 7 +++++++ src-tauri/Cargo.toml | 2 +- src-tauri/src/remote/auth.rs | 16 +++++++++++++--- src-tauri/tauri.conf.json | 6 +++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/composables/state-navigation.ts b/composables/state-navigation.ts index 46d9e2b..3eb8181 100644 --- a/composables/state-navigation.ts +++ b/composables/state-navigation.ts @@ -1,9 +1,11 @@ +import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; import { data } from "autoprefixer"; import { AppStatus, type AppState } from "~/types"; export function setupHooks() { const router = useRouter(); + const state = useAppState(); listen("auth/processing", (event) => { router.push("/auth/processing"); @@ -15,8 +17,9 @@ export function setupHooks() { ); }); - listen("auth/finished", (event) => { + listen("auth/finished", async (event) => { router.push("/store"); + state.value = JSON.parse(await invoke("fetch_state")); }); listen("download_error", (event) => { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 77755ee..b0f233d 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2212,6 +2212,12 @@ dependencies = [ "serde", ] +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + [[package]] name = "http-serde" version = "1.1.3" @@ -5247,6 +5253,7 @@ dependencies = [ "gtk", "heck 0.5.0", "http 1.3.1", + "http-range", "jni", "libc", "log", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 5faba5e..b3fda91 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -75,7 +75,7 @@ features = ["curly"] [dependencies.tauri] version = "2.1.1" -features = ["tray-icon"] +features = ["protocol-asset", "tray-icon"] [dependencies.tokio] version = "1.40.0" diff --git a/src-tauri/src/remote/auth.rs b/src-tauri/src/remote/auth.rs index 346a224..fc242a1 100644 --- a/src-tauri/src/remote/auth.rs +++ b/src-tauri/src/remote/auth.rs @@ -1,11 +1,11 @@ -use std::{collections::HashMap, env}; +use std::{collections::HashMap, env, sync::Mutex}; use chrono::Utc; use droplet_rs::ssl::sign_nonce; use gethostname::gethostname; use log::{debug, error, warn}; use serde::{Deserialize, Serialize}; -use tauri::{AppHandle, Emitter}; +use tauri::{AppHandle, Emitter, Manager}; use url::Url; use crate::{ @@ -14,7 +14,7 @@ use crate::{ models::data::DatabaseAuth, }, error::{drop_server_error::DropServerError, remote_access_error::RemoteAccessError}, - AppStatus, User, + AppState, AppStatus, User, }; use super::{ @@ -157,6 +157,16 @@ pub fn recieve_handshake(app: AppHandle, path: String) { return; } + let app_state = app.state::>(); + let mut state_lock = app_state.lock().unwrap(); + + let (app_status, user) = setup(); + + state_lock.status = app_status; + state_lock.user = user; + + drop(state_lock); + app.emit("auth/finished", ()).unwrap(); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index daf149f..ce42161 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -11,7 +11,11 @@ }, "app": { "security": { - "csp": null + "csp": null, + "assetProtocol": { + "enable": true, + "scope": {} + } } }, "plugins": { From c3ee09af85109f2d13a7fa05ada055f7a22ddf9d Mon Sep 17 00:00:00 2001 From: quexeky Date: Sat, 7 Jun 2025 06:35:57 +1000 Subject: [PATCH 04/40] fix: Update broken README link in docs Signed-off-by: quexeky --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 903f4ca..6ef228f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Drop app is the companion app for [Drop](https://github.com/Drop-OSS/drop). It u ## Running Before setting up the drop app, be sure that you have a server set up. -The instructions for this can be found on the [Drop Wiki](https://wiki.droposs.org/guides/quickstart.html) +The instructions for this can be found on the [Drop Docs](https://docs.droposs.org/guides/quickstart.html) ## Current features Currently supported are the following features: From 6d295bd47fee5d1572485a588b722994a5981124 Mon Sep 17 00:00:00 2001 From: quexeky Date: Sat, 7 Jun 2025 06:37:14 +1000 Subject: [PATCH 05/40] fix: Broken README path Signed-off-by: quexeky --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ef228f..f66cea8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Drop app is the companion app for [Drop](https://github.com/Drop-OSS/drop). It u ## Running Before setting up the drop app, be sure that you have a server set up. -The instructions for this can be found on the [Drop Docs](https://docs.droposs.org/guides/quickstart.html) +The instructions for this can be found on the [Drop Docs](https://docs.droposs.org/docs/guides/quickstart) ## Current features Currently supported are the following features: From 885fa42ecc239cdf981d582c2a8dbf82fc80b7b7 Mon Sep 17 00:00:00 2001 From: quexeky Date: Wed, 25 Jun 2025 06:53:42 +1000 Subject: [PATCH 06/40] fix: Move Authorization header generation to download_game_chunk() Signed-off-by: quexeky --- src-tauri/src/games/downloads/download_agent.rs | 2 +- src-tauri/src/games/downloads/download_logic.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/games/downloads/download_agent.rs b/src-tauri/src/games/downloads/download_agent.rs index 267cd9b..6c6ad63 100644 --- a/src-tauri/src/games/downloads/download_agent.rs +++ b/src-tauri/src/games/downloads/download_agent.rs @@ -274,7 +274,7 @@ impl GameDownloadAgent { ("name", &context.file_name), ("chunk", &context.index.to_string()), ], - |r| r.header("Authorization", generate_authorization_header()), + |r| { r }, ) { Ok(request) => request, Err(e) => { diff --git a/src-tauri/src/games/downloads/download_logic.rs b/src-tauri/src/games/downloads/download_logic.rs index 6ec5ed3..dd7d0a5 100644 --- a/src-tauri/src/games/downloads/download_logic.rs +++ b/src-tauri/src/games/downloads/download_logic.rs @@ -1,8 +1,11 @@ -use crate::download_manager::util::download_thread_control_flag::{DownloadThreadControl, DownloadThreadControlFlag}; +use crate::download_manager::util::download_thread_control_flag::{ + DownloadThreadControl, DownloadThreadControlFlag, +}; use crate::download_manager::util::progress_object::ProgressHandle; use crate::error::application_download_error::ApplicationDownloadError; use crate::error::remote_access_error::RemoteAccessError; use crate::games::downloads::manifest::DropDownloadContext; +use crate::remote::auth::generate_authorization_header; use log::warn; use md5::{Context, Digest}; use reqwest::blocking::{RequestBuilder, Response}; @@ -124,6 +127,7 @@ pub fn download_game_chunk( progress.set(0); return Ok(false); } + request.header("Authorization", generate_authorization_header()); let response = request .send() From afcd4e916f9a6944b330f04c2a41bf6646f22eb6 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Wed, 25 Jun 2025 09:05:08 +1000 Subject: [PATCH 07/40] chore: bump version to 0.3.0-rc-4 --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9cec3e6..7f173aa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "drop-app", "private": true, - "version": "0.3.0-rc-3", + "version": "0.3.0-rc-4", "type": "module", "scripts": { "build": "nuxt build", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b0f233d..6d29c5e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "drop-app" -version = "0.3.0-rc-3" +version = "0.3.0-rc-4" dependencies = [ "atomic-instant-full", "boxcar", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b3fda91..ee127c4 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drop-app" -version = "0.3.0-rc-3" +version = "0.3.0-rc-4" description = "The client application for the open-source, self-hosted game distribution platform Drop" authors = ["Drop OSS"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ce42161..1943a0f 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2.0.0", "productName": "Drop Desktop Client", - "version": "0.3.0-rc-3", + "version": "0.3.0-rc-4", "identifier": "dev.drop.app", "build": { "beforeDevCommand": "yarn dev --port 1432", From 2874b9776b86bd9b7f401be782ac1f527176a24c Mon Sep 17 00:00:00 2001 From: quexeky Date: Wed, 25 Jun 2025 09:17:06 +1000 Subject: [PATCH 08/40] fix: Accidentally moved request when setting the header Signed-off-by: quexeky --- src-tauri/src/games/downloads/download_logic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/games/downloads/download_logic.rs b/src-tauri/src/games/downloads/download_logic.rs index dd7d0a5..c8acad5 100644 --- a/src-tauri/src/games/downloads/download_logic.rs +++ b/src-tauri/src/games/downloads/download_logic.rs @@ -127,7 +127,7 @@ pub fn download_game_chunk( progress.set(0); return Ok(false); } - request.header("Authorization", generate_authorization_header()); + let request = request.header("Authorization", generate_authorization_header()); let response = request .send() From f560a62c8f428378f4c1d514595b56cb88009490 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Mon, 14 Jul 2025 16:31:06 +1000 Subject: [PATCH 09/40] Download fixes (#63) * refactor: Rename StoredManifest to DropData Signed-off-by: quexeky * fix: Downloads when resuming would truncate files which had not been finished Signed-off-by: quexeky * chore: Didn't import debug macro Signed-off-by: quexeky * fix: Download chunks with wrong indexes Migrated to using checksums as indexes instead Signed-off-by: quexeky * feat: Resume download button Also added DBWrite and DBRead structs to make database management easier Signed-off-by: quexeky * feat: Download resuming Signed-off-by: quexeky * feat: Resume button and PartiallyInstalled status Signed-off-by: quexeky * feat: Download validation Signed-off-by: quexeky * chore: Ran cargo fix & cargo fmt Signed-off-by: quexeky * fix: download validation, installs, etc * chore: version bump --------- Signed-off-by: quexeky Co-authored-by: quexeky --- components/GameStatusButton.vue | 105 ++++----- components/LibrarySearch.vue | 2 + package.json | 2 +- pages/library/[id]/index.vue | 11 + pages/queue.vue | 7 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/src/client/autostart.rs | 3 +- src-tauri/src/client/mod.rs | 2 +- src-tauri/src/database/commands.rs | 11 +- src-tauri/src/database/db.rs | 65 ++++-- src-tauri/src/database/models.rs | 209 +++++++++++++----- .../src/download_manager/download_manager.rs | 4 +- .../download_manager_builder.rs | 32 ++- .../src/download_manager/downloadable.rs | 4 +- src-tauri/src/download_manager/mod.rs | 2 +- src-tauri/src/download_manager/util/mod.rs | 2 +- .../download_manager/util/progress_object.rs | 21 +- .../util/rolling_progress_updates.rs | 5 + .../src/error/application_download_error.rs | 2 +- src-tauri/src/error/backup_error.rs | 4 +- src-tauri/src/error/mod.rs | 4 +- src-tauri/src/games/commands.rs | 5 +- src-tauri/src/games/downloads/commands.rs | 50 ++++- .../src/games/downloads/download_agent.rs | 170 ++++++++------ .../src/games/downloads/download_logic.rs | 46 +++- src-tauri/src/games/downloads/drop_data.rs | 105 +++++++++ src-tauri/src/games/downloads/mod.rs | 3 +- .../src/games/downloads/stored_manifest.rs | 79 ------- src-tauri/src/games/downloads/validate.rs | 201 +++++++++++++++++ src-tauri/src/games/library.rs | 86 +++++-- src-tauri/src/lib.rs | 6 +- src-tauri/src/process/process_manager.rs | 14 +- src-tauri/src/remote/auth.rs | 6 +- src-tauri/src/remote/commands.rs | 4 +- src-tauri/src/remote/remote.rs | 8 +- src-tauri/src/remote/server_proto.rs | 5 +- src-tauri/tauri.conf.json | 2 +- types.ts | 2 + 39 files changed, 932 insertions(+), 361 deletions(-) create mode 100644 src-tauri/src/games/downloads/drop_data.rs delete mode 100644 src-tauri/src/games/downloads/stored_manifest.rs create mode 100644 src-tauri/src/games/downloads/validate.rs diff --git a/components/GameStatusButton.vue b/components/GameStatusButton.vue index 9731721..a10fd27 100644 --- a/components/GameStatusButton.vue +++ b/components/GameStatusButton.vue @@ -1,78 +1,52 @@