Skip to content

Commit

Permalink
Apply to SK2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed May 18, 2019
1 parent 61033b9 commit ec95dc4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions ArchiSteamFarm/ArchiWebHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,17 @@ internal async Task<uint> GetServerTime() {
return null;
}

bool hasTradeToken = !string.IsNullOrEmpty(tradeToken);

Dictionary<string, object> arguments = new Dictionary<string, object>(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++) {
Expand All @@ -1763,11 +1774,7 @@ internal async Task<uint> 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);
Expand Down Expand Up @@ -1916,9 +1923,9 @@ internal async Task<bool> 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);
Expand Down

0 comments on commit ec95dc4

Please sign in to comment.