Merge pull request #161 from dyc3/confirmation-debug-logging

add some more debug logging around sending confirmations
This commit is contained in:
Carson McManus 2022-07-23 07:51:14 -04:00 committed by GitHub
commit 980a14deb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,15 +184,28 @@ impl SteamGuardAccount {
pub success: bool,
}
let resp: SendConfirmationResponse = client.get("https://steamcommunity.com/mobileconf/ajaxop".parse::<Url>().unwrap())
let resp = client.get("https://steamcommunity.com/mobileconf/ajaxop".parse::<Url>().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(())
}