forked from Drop-OSS/archived-drop-app
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f85d21f97 |
@@ -73,7 +73,7 @@
|
|||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-flex items-center gap-x-2">
|
<div class="truncate inline-flex items-center gap-x-2">
|
||||||
<p
|
<p
|
||||||
class="text-sm whitespace-nowrap font-display font-semibold"
|
class="text-sm whitespace-nowrap font-display font-semibold"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
pub enum Platform {
|
pub enum Platform {
|
||||||
Windows,
|
Windows,
|
||||||
Linux,
|
Linux,
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
macOS,
|
macOS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,8 @@ pub fn download_game_bucket(
|
|||||||
return Err(ApplicationDownloadError::DownloadError(
|
return Err(ApplicationDownloadError::DownloadError(
|
||||||
RemoteAccessError::InvalidResponse(DropServerError {
|
RemoteAccessError::InvalidResponse(DropServerError {
|
||||||
status_code: 400,
|
status_code: 400,
|
||||||
status_message: format!(
|
status_message: "Server Error".to_owned(),
|
||||||
|
message: format!(
|
||||||
"invalid number of Content-Lengths recieved: {i}, {lengths}"
|
"invalid number of Content-Lengths recieved: {i}, {lengths}"
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
@@ -245,7 +246,8 @@ pub fn download_game_bucket(
|
|||||||
return Err(ApplicationDownloadError::DownloadError(
|
return Err(ApplicationDownloadError::DownloadError(
|
||||||
RemoteAccessError::InvalidResponse(DropServerError {
|
RemoteAccessError::InvalidResponse(DropServerError {
|
||||||
status_code: 400,
|
status_code: 400,
|
||||||
status_message: format!(
|
status_message: "Server Error".to_owned(),
|
||||||
|
message: format!(
|
||||||
"for {}, expected {}, got {} ({})",
|
"for {}, expected {}, got {} ({})",
|
||||||
drop.filename, drop.length, raw_length, length
|
drop.filename, drop.length, raw_length, length
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ pub async fn fetch_user() -> Result<User, RemoteAccessError> {
|
|||||||
let err: DropServerError = response.json().await?;
|
let err: DropServerError = response.json().await?;
|
||||||
warn!("{err:?}");
|
warn!("{err:?}");
|
||||||
|
|
||||||
if err.status_message == "Nonce expired" {
|
if err.message == "Nonce expired" {
|
||||||
return Err(RemoteAccessError::OutOfSync);
|
return Err(RemoteAccessError::OutOfSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +106,8 @@ pub fn auth_initiate_logic(mode: String) -> Result<String, RemoteAccessError> {
|
|||||||
name: format!("{} (Desktop)", hostname.display()),
|
name: format!("{} (Desktop)", hostname.display()),
|
||||||
platform: env::consts::OS.to_string(),
|
platform: env::consts::OS.to_string(),
|
||||||
capabilities: HashMap::from([
|
capabilities: HashMap::from([
|
||||||
("peerAPI".to_owned(), CapabilityConfiguration {}),
|
("PeerAPI".to_owned(), CapabilityConfiguration {}),
|
||||||
("cloudSaves".to_owned(), CapabilityConfiguration {}),
|
("CloudSaves".to_owned(), CapabilityConfiguration {}),
|
||||||
]),
|
]),
|
||||||
mode,
|
mode,
|
||||||
};
|
};
|
||||||
@@ -117,9 +117,9 @@ pub fn auth_initiate_logic(mode: String) -> Result<String, RemoteAccessError> {
|
|||||||
|
|
||||||
if response.status() != 200 {
|
if response.status() != 200 {
|
||||||
let data: DropServerError = response.json()?;
|
let data: DropServerError = response.json()?;
|
||||||
error!("could not start handshake: {}", data.status_message);
|
error!("could not start handshake: {:?}", data);
|
||||||
|
|
||||||
return Err(RemoteAccessError::HandshakeFailed(data.status_message));
|
return Err(RemoteAccessError::HandshakeFailed(data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = response.text()?;
|
let response = response.text()?;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use serde::Deserialize;
|
|||||||
pub struct DropServerError {
|
pub struct DropServerError {
|
||||||
pub status_code: usize,
|
pub status_code: usize,
|
||||||
pub status_message: String,
|
pub status_message: String,
|
||||||
// pub message: String,
|
pub message: String,
|
||||||
// pub url: String,
|
// pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ impl Display for RemoteAccessError {
|
|||||||
RemoteAccessError::InvalidResponse(error) => write!(
|
RemoteAccessError::InvalidResponse(error) => write!(
|
||||||
f,
|
f,
|
||||||
"server returned an invalid response: {}, {}",
|
"server returned an invalid response: {}, {}",
|
||||||
error.status_code, error.status_message
|
error.status_code, error.message
|
||||||
),
|
),
|
||||||
RemoteAccessError::UnparseableResponse(error) => {
|
RemoteAccessError::UnparseableResponse(error) => {
|
||||||
write!(f, "server returned an invalid response: {error}")
|
write!(f, "server returned an invalid response: {error}")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use games::{
|
|||||||
library::{FetchGameStruct, FrontendGameOptions, Game, get_current_meta, uninstall_game_logic},
|
library::{FetchGameStruct, FrontendGameOptions, Game, get_current_meta, uninstall_game_logic},
|
||||||
state::{GameStatusManager, GameStatusWithTransient},
|
state::{GameStatusManager, GameStatusWithTransient},
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::{info, warn};
|
||||||
use process::PROCESS_MANAGER;
|
use process::PROCESS_MANAGER;
|
||||||
use remote::{
|
use remote::{
|
||||||
auth::generate_authorization_header,
|
auth::generate_authorization_header,
|
||||||
@@ -55,7 +55,8 @@ pub async fn fetch_library_logic(
|
|||||||
if response.status() != 200 {
|
if response.status() != 200 {
|
||||||
let err = response.json().await.unwrap_or(DropServerError {
|
let err = response.json().await.unwrap_or(DropServerError {
|
||||||
status_code: 500,
|
status_code: 500,
|
||||||
status_message: "Invalid response from server.".to_owned(),
|
status_message: "Server Error".to_owned(),
|
||||||
|
message: "Invalid response from server.".to_owned(),
|
||||||
});
|
});
|
||||||
warn!("{err:?}");
|
warn!("{err:?}");
|
||||||
return Err(RemoteAccessError::InvalidResponse(err));
|
return Err(RemoteAccessError::InvalidResponse(err));
|
||||||
@@ -223,6 +224,11 @@ pub async fn fetch_game_version_options_logic(
|
|||||||
return Err(RemoteAccessError::InvalidResponse(err));
|
return Err(RemoteAccessError::InvalidResponse(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let raw = response.text().await?;
|
||||||
|
info!("{}", raw);
|
||||||
|
|
||||||
|
return Err(RemoteAccessError::CorruptedState);
|
||||||
|
|
||||||
let data: Vec<GameVersion> = response.json().await?;
|
let data: Vec<GameVersion> = response.json().await?;
|
||||||
|
|
||||||
let state_lock = state.lock();
|
let state_lock = state.lock();
|
||||||
|
|||||||
Reference in New Issue
Block a user