mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 00:31:33 +10:00
Manifests are now being parsed successfully
This commit is contained in:
@ -8,6 +8,7 @@ use versions::Version;
|
|||||||
use crate::{AppState, DB};
|
use crate::{AppState, DB};
|
||||||
use crate::auth::generate_authorization_header;
|
use crate::auth::generate_authorization_header;
|
||||||
use crate::db::DatabaseImpls;
|
use crate::db::DatabaseImpls;
|
||||||
|
use crate::downloads::manifest::DropManifest;
|
||||||
use crate::downloads::progress::ProgressChecker;
|
use crate::downloads::progress::ProgressChecker;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@ -78,7 +79,6 @@ impl GameDownload {
|
|||||||
return Err(GameDownloadError::ManifestAlreadyExists);
|
return Err(GameDownloadError::ManifestAlreadyExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Getting url components");
|
|
||||||
let base_url = DB.fetch_base_url();
|
let base_url = DB.fetch_base_url();
|
||||||
let manifest_url = base_url
|
let manifest_url = base_url
|
||||||
.join(
|
.join(
|
||||||
@ -91,7 +91,6 @@ impl GameDownload {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Generating authorization header");
|
|
||||||
let header = generate_authorization_header();
|
let header = generate_authorization_header();
|
||||||
|
|
||||||
info!("Generating & sending client");
|
info!("Generating & sending client");
|
||||||
@ -103,13 +102,14 @@ impl GameDownload {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Got status");
|
|
||||||
if response.status() != 200 {
|
if response.status() != 200 {
|
||||||
info!("Error status: {}", response.status());
|
info!("Error status: {}", response.status());
|
||||||
return Err(GameDownloadError::StatusError(response.status().as_u16()));
|
return Err(GameDownloadError::StatusError(response.status().as_u16()));
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("{}", response.text().await.unwrap());
|
//info!("{}", response.text().await.unwrap());
|
||||||
|
|
||||||
|
info!("Parsed manifest: {:?}", response.json::<DropManifest>().await.unwrap());
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
pub(crate) struct DropManifest {
|
use std::collections::HashMap;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
}
|
pub type DropManifest = HashMap<String, DropChunk>;
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||||
pub struct DropChunk {
|
pub struct DropChunk {
|
||||||
permissions: usize,
|
permissions: usize,
|
||||||
ids: Vec<String>,
|
ids: Vec<String>,
|
||||||
checksums: Vec<String>,
|
checksums: Vec<String>,
|
||||||
lengths: Vec<String>
|
lengths: Vec<usize>
|
||||||
}
|
}
|
||||||
|
|
||||||
type Manifest = (DropManifest, DropChunk);
|
|
||||||
Reference in New Issue
Block a user