Fix new confirmation method for proper multi-confirmations support, closes #297

This commit is contained in:
JustArchi
2016-07-16 21:03:39 +02:00
parent 1227709bc2
commit 7bc8dab972
3 changed files with 54 additions and 9 deletions

View File

@@ -345,12 +345,24 @@ namespace ArchiSteamFarm {
return false;
}
StringBuilder request = new StringBuilder(SteamCommunityURL + "/mobileconf/multiajaxop?op=" + (accept ? "allow" : "cancel") + "&p=" + deviceID + "&a=" + SteamID + "&k=" + WebUtility.UrlEncode(confirmationHash) + "&t=" + time + "&m=android&tag=conf");
string request = SteamCommunityURL + "/mobileconf/multiajaxop";
List<KeyValuePair<string, string>> data = new List<KeyValuePair<string, string>>(7 + confirmations.Count * 2) {
new KeyValuePair<string, string>("op", accept ? "allow" : "cancel"),
new KeyValuePair<string, string>("p", deviceID),
new KeyValuePair<string, string>("a", SteamID.ToString()),
new KeyValuePair<string, string>("k", confirmationHash),
new KeyValuePair<string, string>("t", time.ToString()),
new KeyValuePair<string, string>("m", "android"),
new KeyValuePair<string, string>("tag", "conf")
};
foreach (MobileAuthenticator.Confirmation confirmation in confirmations) {
request.Append("&cid[]=" + confirmation.ID + "&ck[]=" + confirmation.Key);
data.Add(new KeyValuePair<string, string>("cid[]", confirmation.ID.ToString()));
data.Add(new KeyValuePair<string, string>("ck[]", confirmation.Key.ToString()));
}
string json = await WebBrowser.UrlGetToContentRetry(request.ToString()).ConfigureAwait(false);
string json = await WebBrowser.UrlPostToContentRetry(request, data).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
return false;
}