From ec95dc41cec3ba1052380ca2be866e15087295ca Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 18 May 2019 23:59:37 +0200 Subject: [PATCH] Apply to SK2 changes https://github.com/SteamRE/SteamKit/releases --- ArchiSteamFarm/ArchiWebHandler.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index cce8da21cfe00..45ce321bcc93f 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -1752,6 +1752,17 @@ internal async Task GetServerTime() { return null; } + bool hasTradeToken = !string.IsNullOrEmpty(tradeToken); + + Dictionary arguments = new Dictionary(hasTradeToken ? 3 : 2) { + { "key", steamApiKey }, + { "steamid_target", steamID } + }; + + if (hasTradeToken) { + arguments["trade_offer_access_token"] = tradeToken; + } + KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) { @@ -1763,11 +1774,7 @@ internal async Task GetServerTime() { WebAPI.DefaultBaseAddress.Host, // ReSharper disable once AccessToDisposedClosure - async () => await iEconService.GetTradeHoldDurations( - key: steamApiKey, - steamid_target: steamID, - trade_offer_access_token: tradeToken ?? "" // TODO: Change me once https://github.com/SteamRE/SteamKit/pull/522 is merged - ) + async () => await iEconService.GetTradeHoldDurations(arguments) ).ConfigureAwait(false); } catch (TaskCanceledException e) { Bot.ArchiLogger.LogGenericDebuggingException(e); @@ -1916,9 +1923,9 @@ internal async Task Init(ulong steamID, EUniverse universe, string webAPIU // ReSharper disable once AccessToDisposedClosure async () => await iSteamUserAuth.AuthenticateUser( - encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(encryptedLoginKey, 0, encryptedLoginKey.Length)), + encrypted_loginkey: encryptedLoginKey, method: WebRequestMethods.Http.Post, - sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(encryptedSessionKey, 0, encryptedSessionKey.Length)), + sessionkey: encryptedSessionKey, steamid: steamID ) ).ConfigureAwait(false);