Fix client running behind reverse proxy (#69)

* fix: reverse proxy 400 due to duplicate header

* fix: clippy

* bump version and update ci
This commit is contained in:
DecDuck
2025-07-18 20:08:12 +10:00
committed by GitHub
parent 2913fdf35b
commit d19f9bbc31
8 changed files with 24 additions and 37 deletions

View File

@ -22,9 +22,9 @@ jobs:
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-24.04' # for Tauri v1 you could replace this with ubuntu-20.04.
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
args: ''
- platform: 'ubuntu-24.04-arm'
- platform: 'ubuntu-22.04-arm'
args: '--target aarch64-unknown-linux-gnu'
- platform: 'windows-latest'
args: ''
@ -48,12 +48,11 @@ jobs:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-24.04' # This must match the platform value defined above.
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.

View File

@ -1,7 +1,7 @@
{
"name": "drop-app",
"private": true,
"version": "0.3.0-rc-6",
"version": "0.3.0-rc-7",
"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-6"
version = "0.3.0-rc-7"
dependencies = [
"atomic-instant-full",
"boxcar",

View File

@ -1,6 +1,6 @@
[package]
name = "drop-app"
version = "0.3.0-rc-6"
version = "0.3.0-rc-7"
description = "The client application for the open-source, self-hosted game distribution platform Drop"
authors = ["Drop OSS"]
edition = "2021"

View File

@ -18,6 +18,7 @@ pub enum RemoteAccessError {
HandshakeFailed(String),
GameNotFound(String),
InvalidResponse(DropServerError),
UnparseableResponse(String),
ManifestDownloadFailed(StatusCode, String),
OutOfSync,
Cache(cacache::Error),
@ -48,7 +49,8 @@ impl Display for RemoteAccessError {
RemoteAccessError::InvalidEndpoint => write!(f, "invalid drop endpoint"),
RemoteAccessError::HandshakeFailed(message) => write!(f, "failed to complete handshake: {message}"),
RemoteAccessError::GameNotFound(id) => write!(f, "could not find game on server: {id}"),
RemoteAccessError::InvalidResponse(error) => write!(f, "server returned an invalid response: {} {}", error.status_code, error.status_message),
RemoteAccessError::InvalidResponse(error) => write!(f, "server returned an invalid response: {}, {}", error.status_code, error.status_message),
RemoteAccessError::UnparseableResponse(error) => write!(f, "server returned an invalid response: {error}"),
RemoteAccessError::ManifestDownloadFailed(status, response) => write!(
f,
"failed to download game manifest: {status} {response}"

View File

@ -313,18 +313,9 @@ impl GameDownloadAgent {
match download_game_chunk(context, &self.control_flag, progress_handle, request)
{
Ok(true) => {
debug!(
"Finished context #{} with checksum {}",
index, context.checksum
);
completed_indexes.push(context.checksum.clone());
}
Ok(false) => {
debug!(
"Didn't finish context #{} with checksum {}",
index, context.checksum
);
}
Ok(false) => {}
Err(e) => {
error!("{e}");
sender.send(DownloadManagerSignal::Error(e)).unwrap();
@ -350,10 +341,7 @@ impl GameDownloadAgent {
.map(|x| {
(
x.checksum.clone(),
context_map_lock
.get(&x.checksum)
.cloned()
.unwrap_or(false),
context_map_lock.get(&x.checksum).cloned().unwrap_or(false),
)
})
.collect::<Vec<(String, bool)>>();

View File

@ -3,6 +3,7 @@ use crate::download_manager::util::download_thread_control_flag::{
};
use crate::download_manager::util::progress_object::ProgressHandle;
use crate::error::application_download_error::ApplicationDownloadError;
use crate::error::drop_server_error::DropServerError;
use crate::error::remote_access_error::RemoteAccessError;
use crate::games::downloads::manifest::DropDownloadContext;
use crate::remote::auth::generate_authorization_header;
@ -40,11 +41,9 @@ impl DropWriter<File> {
// Write automatically pushes to file and hasher
impl Write for DropWriter<File> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.hasher.write_all(buf).map_err(|e| {
io::Error::other(
format!("Unable to write to hasher: {e}"),
)
})?;
self.hasher
.write_all(buf)
.map_err(|e| io::Error::other(format!("Unable to write to hasher: {e}")))?;
self.destination.write(buf)
}
@ -134,17 +133,11 @@ pub fn download_game_chunk(
progress: ProgressHandle,
request: RequestBuilder,
) -> Result<bool, ApplicationDownloadError> {
debug!(
"Starting download chunk {}, {}, {} #{}",
ctx.file_name, ctx.index, ctx.offset, ctx.checksum
);
// If we're paused
if control_flag.get() == DownloadThreadControlFlag::Stop {
progress.set(0);
return Ok(false);
}
let request = request.header("Authorization", generate_authorization_header());
let response = request
.header("Authorization", generate_authorization_header())
.send()
@ -152,9 +145,14 @@ pub fn download_game_chunk(
if response.status() != 200 {
debug!("chunk request got status code: {}", response.status());
let err = response.json().unwrap();
let raw_res = response.text().unwrap();
if let Ok(err) = serde_json::from_str::<DropServerError>(&raw_res) {
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::InvalidResponse(err),
));
};
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::InvalidResponse(err),
RemoteAccessError::UnparseableResponse(raw_res),
));
}

View File

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