2 hours for this commit, I know I'm dumb

This commit is contained in:
ALEZ-DEV 2024-04-24 23:16:05 +02:00
parent c60ad6a587
commit 2c997938c4
4 changed files with 38 additions and 6 deletions

View File

@ -38,6 +38,19 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "async-compression"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07dbbf24db18d609b1462965249abdf49129ccad073ec257da372adc83259c60"
dependencies = [
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
"tokio",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.2.0" version = "1.2.0"
@ -1131,6 +1144,7 @@ version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338"
dependencies = [ dependencies = [
"async-compression",
"base64", "base64",
"bytes", "bytes",
"encoding_rs", "encoding_rs",
@ -1159,6 +1173,7 @@ dependencies = [
"system-configuration", "system-configuration",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-util",
"tower-service", "tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",

View File

@ -38,6 +38,19 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "async-compression"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07dbbf24db18d609b1462965249abdf49129ccad073ec257da372adc83259c60"
dependencies = [
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
"tokio",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.2.0" version = "1.2.0"
@ -992,6 +1005,7 @@ version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338"
dependencies = [ dependencies = [
"async-compression",
"base64", "base64",
"bytes", "bytes",
"encoding_rs", "encoding_rs",
@ -1020,6 +1034,7 @@ dependencies = [
"system-configuration", "system-configuration",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-util",
"tower-service", "tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",

View File

@ -12,7 +12,7 @@ dotenv = "0.15.0"
downloader = { git = "https://github.com/ALEZ-DEV/downloader" } # version = "0.2.7", downloader = { git = "https://github.com/ALEZ-DEV/downloader" } # version = "0.2.7",
flate2 = "1.0.28" flate2 = "1.0.28"
log = "0.4.21" log = "0.4.21"
reqwest = "0.12.2" reqwest = { version = "0.12.2", features = ["gzip"] }
serde = { version = "1.0.197", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115" serde_json = "1.0.115"
tar = "0.4.40" tar = "0.4.40"

View File

@ -1,4 +1,5 @@
use log::debug; use log::debug;
use reqwest::header::USER_AGENT;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
@ -95,15 +96,16 @@ pub struct SampleHashInfo {
// end data --------------------------------------------------------------------- // end data ---------------------------------------------------------------------
static URL: &str = static URL: &str = concat!(
concat!("https://prod-alicdn-gamestarter.k", "uro", "gam", "e.com/pcstarter/prod/game/G143/4/index.json"); "https://prod-alicdn-gamestarter.k",
"uro",
"gam",
"e.com/pcstarter/prod/game/G143/4/index.json"
);
pub async fn fetch_game_info() -> anyhow::Result<GameInfo> { pub async fn fetch_game_info() -> anyhow::Result<GameInfo> {
let response = reqwest::get(URL).await?; let response = reqwest::get(URL).await?;
debug!("{:?}", response.headers());
response.headers_mut().
let body = response.text().await?; let body = response.text().await?;
debug!("{}", &body);
Ok(serde_json::from_str(&body)?) Ok(serde_json::from_str(&body)?)
} }