From 2409fac47e14ec460071fe1ba5bd3b5a1755c78c Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sat, 23 Jul 2022 07:42:29 -0400 Subject: [PATCH] add some more debug logging around sending confirmations --- steamguard/src/lib.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/steamguard/src/lib.rs b/steamguard/src/lib.rs index 9d44a0c..0f02adb 100644 --- a/steamguard/src/lib.rs +++ b/steamguard/src/lib.rs @@ -184,15 +184,28 @@ impl SteamGuardAccount { pub success: bool, } - let resp: SendConfirmationResponse = client.get("https://steamcommunity.com/mobileconf/ajaxop".parse::().unwrap()) + let resp = client.get("https://steamcommunity.com/mobileconf/ajaxop".parse::().unwrap()) .header("X-Requested-With", "com.valvesoftware.android.steam.community") .header(USER_AGENT, "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30") .header(COOKIE, cookies.cookies(&url).unwrap()) .query(&query_params) - .send()? - .json()?; + .send()?; + + trace!("send_confirmation_ajax() response: {:?}", &resp); + debug!( + "send_confirmation_ajax() response status code: {}", + &resp.status() + ); + + let raw = resp.text()?; + debug!("send_confirmation_ajax() response body: {:?}", &raw); + + let body: SendConfirmationResponse = serde_json::from_str(raw.as_str())?; + + if !body.success { + return Err(anyhow!("Server responded with failure.")); + } - ensure!(resp.success); Ok(()) }