Compare commits

..

10 Commits

Author SHA1 Message Date
a5082ee2f3 chore: Ran cargo fix & cargo fmt
Signed-off-by: quexeky <git@quexeky.dev>
2025-07-04 14:36:43 +10:00
c38f1fbad3 feat: Download validation
Signed-off-by: quexeky <git@quexeky.dev>
2025-07-04 14:27:34 +10:00
6a3029473c feat: Resume button and PartiallyInstalled status
Signed-off-by: quexeky <git@quexeky.dev>
2025-06-26 15:57:20 +10:00
8dfb96406f feat: Download resuming
Signed-off-by: quexeky <git@quexeky.dev>
2025-06-22 13:01:18 +10:00
fd61903130 feat: Resume download button
Also added DBWrite and DBRead structs to make database management easier

Signed-off-by: quexeky <git@quexeky.dev>
2025-06-21 12:51:50 +10:00
abf371c9fc fix: Download chunks with wrong indexes
Migrated to using checksums as indexes instead

Signed-off-by: quexeky <git@quexeky.dev>
2025-06-18 09:51:49 +10:00
e8bcc67ed4 chore: Didn't import debug macro
Signed-off-by: quexeky <git@quexeky.dev>
2025-06-12 10:23:57 +10:00
8c403eb8d7 fix: Downloads when resuming would truncate files which had not been finished
Signed-off-by: quexeky <git@quexeky.dev>
2025-06-12 10:23:01 +10:00
47f64a3c68 Merge branch 'develop' into 55-feature-request-game-scanning-for-dropdata-to-import-existing-games 2025-06-10 12:01:46 +10:00
ae04099daa refactor: Rename StoredManifest to DropData
Signed-off-by: quexeky <git@quexeky.dev>
2025-06-07 09:54:41 +10:00
12 changed files with 16 additions and 52 deletions

View File

@ -76,7 +76,6 @@ const gameStatusTextStyle: { [key in GameStatusEnum]: string } = {
[GameStatusEnum.Updating]: "text-blue-500",
[GameStatusEnum.Uninstalling]: "text-zinc-100",
[GameStatusEnum.SetupRequired]: "text-yellow-500",
[GameStatusEnum.PartiallyInstalled]: "text-gray-600"
};
const gameStatusText: { [key in GameStatusEnum]: string } = {
[GameStatusEnum.Remote]: "Not installed",
@ -87,7 +86,6 @@ const gameStatusText: { [key in GameStatusEnum]: string } = {
[GameStatusEnum.Uninstalling]: "Uninstalling...",
[GameStatusEnum.SetupRequired]: "Setup required",
[GameStatusEnum.Running]: "Running",
[GameStatusEnum.PartiallyInstalled]: "Partially installed"
};
const router = useRouter();

View File

@ -1,7 +1,7 @@
{
"name": "drop-app",
"private": true,
"version": "0.3.0-rc-5",
"version": "0.3.0-rc-3",
"type": "module",
"scripts": {
"build": "nuxt build",

2
src-tauri/Cargo.lock generated
View File

@ -1247,7 +1247,7 @@ dependencies = [
[[package]]
name = "drop-app"
version = "0.3.0-rc-5"
version = "0.3.0-rc-3"
dependencies = [
"atomic-instant-full",
"boxcar",

View File

@ -1,6 +1,6 @@
[package]
name = "drop-app"
version = "0.3.0-rc-5"
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"

View File

@ -72,7 +72,6 @@ impl Serialize for DownloadManagerStatus {
pub enum DownloadStatus {
Queued,
Downloading,
Validating,
Error,
}

View File

@ -264,8 +264,6 @@ impl DownloadManagerBuilder {
download_agent.metadata(),
&e
);
download_agent.on_error(&app_handle, &e);
sender.send(DownloadManagerSignal::Error(e)).unwrap();
}
}
}

View File

@ -133,11 +133,7 @@ pub fn calculate_update(progress: &ProgressObject) {
let kilobytes_per_second = bytes_since_last_update / (time_since_last_update as usize).max(1);
let bytes_remaining = if (max < current_bytes_downloaded) {
0
} else {
max - current_bytes_downloaded
}; // bytes
let bytes_remaining = max - current_bytes_downloaded; // bytes
progress.update_window(kilobytes_per_second);
push_update(progress, bytes_remaining);

View File

@ -25,7 +25,7 @@ impl Display for ApplicationDownloadError {
ApplicationDownloadError::Setup(error) => write!(f, "an error occurred while setting up the download: {}", error),
ApplicationDownloadError::Lock => write!(f, "failed to acquire lock. Something has gone very wrong internally. Please restart the application"),
ApplicationDownloadError::Checksum => write!(f, "checksum failed to validate for download"),
ApplicationDownloadError::IoError(error) => write!(f, "io error: {}", error),
ApplicationDownloadError::IoError(error) => write!(f, "{}", error),
ApplicationDownloadError::DownloadError => write!(f, "download failed. See Download Manager status for specific error"),
}
}

View File

@ -284,6 +284,8 @@ impl GameDownloadAgent {
continue;
}
debug!("Continuing download chunk {}", index);
let sender = self.sender.clone();
let request = match make_request(
@ -295,7 +297,7 @@ impl GameDownloadAgent {
("name", &context.file_name),
("chunk", &context.index.to_string()),
],
|r| r,
|r| r.header("Authorization", generate_authorization_header()),
) {
Ok(request) => request,
Err(e) => {
@ -433,8 +435,7 @@ impl Downloadable for GameDownloadAgent {
&self.metadata(),
self.stored_manifest.base_path.to_string_lossy().to_string(),
app_handle,
)
.unwrap();
);
}
fn on_cancelled(&self, _app_handle: &tauri::AppHandle) {}
@ -444,7 +445,6 @@ impl Downloadable for GameDownloadAgent {
}
fn validate(&self) -> Result<bool, ApplicationDownloadError> {
*self.status.lock().unwrap() = DownloadStatus::Validating;
game_validate_logic(
&self.stored_manifest,
self.contexts.lock().unwrap().clone(),

View File

@ -5,8 +5,7 @@ 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::{debug, info, warn};
use log::{debug, warn};
use md5::{Context, Digest};
use reqwest::blocking::{RequestBuilder, Response};
@ -98,24 +97,13 @@ impl<'a> DropDownloadPipeline<'a, Response, File> {
return Ok(false);
}
let mut bytes_read = self.source.read(&mut copy_buf)?;
let bytes_read = self.source.read(&mut copy_buf)?;
current_size += bytes_read;
if current_size > self.size {
let over = current_size - self.size;
warn!("server sent too many bytes... {} over", over);
bytes_read -= over;
current_size = self.size;
}
buf_writer.write_all(&copy_buf[0..bytes_read])?;
self.progress.add(bytes_read);
if current_size >= self.size {
debug!(
"finished with final size of {} vs {}",
current_size, self.size
);
if current_size == self.size {
break;
}
}
@ -145,15 +133,12 @@ pub fn download_game_chunk(
progress.set(0);
return Ok(false);
}
let request = request.header("Authorization", generate_authorization_header());
let response = request
.header("Authorization", generate_authorization_header())
.send()
.map_err(|e| ApplicationDownloadError::Communication(e.into()))?;
if response.status() != 200 {
debug!("chunk request got status code: {}", response.status());
let err = response.json().unwrap();
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::InvalidResponse(err),

View File

@ -137,8 +137,7 @@ pub fn validate_game_chunk(
let mut hasher = md5::Context::new();
let completed =
validate_copy(&mut source, &mut hasher, ctx.length, control_flag, progress).unwrap();
let completed = validate_copy(&mut source, &mut hasher, control_flag, progress).unwrap();
if !completed {
return Ok(false);
};
@ -163,14 +162,12 @@ pub fn validate_game_chunk(
fn validate_copy(
source: &mut File,
dest: &mut Context,
size: usize,
control_flag: &DownloadThreadControl,
progress: ProgressHandle,
) -> Result<bool, io::Error> {
let copy_buf_size = 512;
let mut copy_buf = vec![0; copy_buf_size];
let mut buf_writer = BufWriter::with_capacity(1024 * 1024, dest);
let mut total_bytes = 0;
loop {
if control_flag.get() == DownloadThreadControlFlag::Stop {
@ -178,21 +175,12 @@ fn validate_copy(
return Ok(false);
}
let mut bytes_read = source.read(&mut copy_buf)?;
total_bytes += bytes_read;
// If we read over (likely), truncate our read to
// the right size
if total_bytes > size {
let over = total_bytes - size;
bytes_read -= over;
total_bytes = size;
}
let bytes_read = source.read(&mut copy_buf)?;
buf_writer.write_all(&copy_buf[0..bytes_read])?;
progress.add(bytes_read);
if total_bytes >= size {
if bytes_read == 0 {
break;
}
}

View File

@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2.0.0",
"productName": "Drop Desktop Client",
"version": "0.3.0-rc-5",
"version": "0.3.0-rc-3",
"identifier": "dev.drop.app",
"build": {
"beforeDevCommand": "yarn dev --port 1432",