Validated that loading data works

This commit is contained in:
quexeky
2024-10-20 20:45:02 +11:00
parent 07379b2ba8
commit d21b1d2857
2 changed files with 7 additions and 6 deletions

View File

@ -13,7 +13,7 @@ import { invoke } from "@tauri-apps/api/core";
async function requestGame() { async function requestGame() {
console.log("Requested game from FE"); console.log("Requested game from FE");
await invoke("start_game_download", { gameId: "123", gameVersion: "1.2.3", maxThreads: 4 }); await invoke("start_game_download", { gameId: "94b8ac10-a6fc-4a94-b519-e6df78018e26", gameVersion: "1.11.2", maxThreads: 4 });
} }
function requestGameWrapper() { function requestGameWrapper() {
console.log("Wrapper started"); console.log("Wrapper started");
@ -23,4 +23,4 @@ function requestGameWrapper() {
console.log(e); console.log(e);
}) })
} }
</script> </script>

View File

@ -95,19 +95,21 @@ impl GameDownload {
let header = generate_authorization_header(); let header = generate_authorization_header();
info!("Generating & sending client"); info!("Generating & sending client");
let client = reqwest::blocking::Client::new(); let client = reqwest::Client::new();
let response = client let response = client
.get(manifest_url.to_string()) .get(manifest_url.to_string())
.header("Authorization", header) .header("Authorization", header)
.send() .send()
.await
.unwrap(); .unwrap();
info!("Got status"); info!("Got status");
if response.status() != 200 { if response.status() != 200 {
info!("Error status: {}", response.status());
return Err(GameDownloadError::StatusError(response.status().as_u16())); return Err(GameDownloadError::StatusError(response.status().as_u16()));
} }
info!("{:?}", response.text()); info!("{:?}", response.text().await.unwrap());
Ok(()) Ok(())
} }
@ -142,9 +144,8 @@ pub async fn start_game_download(
let tmp = download.clone(); let tmp = download.clone();
//let manifest = &tmp.manifest; //let manifest = &tmp.manifest;
let res = download.download_manifest().await; download.download_manifest().await
res
/* /*
let Some(unlocked) = manifest else { return Err(GameDownloadError::ManifestDoesNotExist) }; let Some(unlocked) = manifest else { return Err(GameDownloadError::ManifestDoesNotExist) };
let lock = unlocked.lock().unwrap(); let lock = unlocked.lock().unwrap();