diff --git a/ArchiSteamFarm.OfficialPlugins.MobileAuthenticator/MobileAuthenticatorWebHandler.cs b/ArchiSteamFarm.OfficialPlugins.MobileAuthenticator/MobileAuthenticatorWebHandler.cs index 564cf430f..ab6ce592e 100644 --- a/ArchiSteamFarm.OfficialPlugins.MobileAuthenticator/MobileAuthenticatorWebHandler.cs +++ b/ArchiSteamFarm.OfficialPlugins.MobileAuthenticator/MobileAuthenticatorWebHandler.cs @@ -60,6 +60,10 @@ internal static class MobileAuthenticatorWebHandler { { "steamid", bot.SteamID } }; + using WebAPI.AsyncInterface twoFactorService = bot.SteamConfiguration.GetAsyncWebAPIInterface(TwoFactorService); + + twoFactorService.Timeout = bot.ArchiWebHandler.WebBrowser.Timeout; + CTwoFactor_AddAuthenticator_Response? response = null; for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) { @@ -67,10 +71,6 @@ internal static class MobileAuthenticatorWebHandler { await Task.Delay(ArchiWebHandler.WebLimiterDelay).ConfigureAwait(false); } - using WebAPI.AsyncInterface twoFactorService = bot.SteamConfiguration.GetAsyncWebAPIInterface(TwoFactorService); - - twoFactorService.Timeout = bot.ArchiWebHandler.WebBrowser.Timeout; - try { // TODO: Move to CallProtobufAsync when we update to SK2 3.2.0+ response = await ArchiWebHandler.WebLimitRequest( @@ -119,6 +119,10 @@ internal static class MobileAuthenticatorWebHandler { { "steamid", bot.SteamID } }; + using WebAPI.AsyncInterface twoFactorService = bot.SteamConfiguration.GetAsyncWebAPIInterface(TwoFactorService); + + twoFactorService.Timeout = bot.ArchiWebHandler.WebBrowser.Timeout; + CTwoFactor_FinalizeAddAuthenticator_Response? response = null; for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) { @@ -126,10 +130,6 @@ internal static class MobileAuthenticatorWebHandler { await Task.Delay(ArchiWebHandler.WebLimiterDelay).ConfigureAwait(false); } - using WebAPI.AsyncInterface twoFactorService = bot.SteamConfiguration.GetAsyncWebAPIInterface(TwoFactorService); - - twoFactorService.Timeout = bot.ArchiWebHandler.WebBrowser.Timeout; - try { // TODO: Move to CallProtobufAsync when we update to SK2 3.2.0+ response = await ArchiWebHandler.WebLimitRequest( diff --git a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs index 69a6d86e2..751cf3350 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs @@ -1597,6 +1597,10 @@ public sealed class ArchiWebHandler : IDisposable { internal HttpClient GenerateDisposableHttpClient() => WebBrowser.GenerateDisposableHttpClient(); internal async Task?> GetAppList() { + using WebAPI.AsyncInterface steamAppsService = Bot.SteamConfiguration.GetAsyncWebAPIInterface(SteamAppsService); + + steamAppsService.Timeout = WebBrowser.Timeout; + KeyValue? response = null; for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) { @@ -1604,10 +1608,6 @@ public sealed class ArchiWebHandler : IDisposable { await Task.Delay(WebLimiterDelay).ConfigureAwait(false); } - using WebAPI.AsyncInterface steamAppsService = Bot.SteamConfiguration.GetAsyncWebAPIInterface(SteamAppsService); - - steamAppsService.Timeout = WebBrowser.Timeout; - try { response = await WebLimitRequest( WebAPI.DefaultBaseAddress, @@ -1712,6 +1712,10 @@ public sealed class ArchiWebHandler : IDisposable { arguments["trade_offer_access_token"] = tradeToken; } + using WebAPI.AsyncInterface econService = Bot.SteamConfiguration.GetAsyncWebAPIInterface(EconService); + + econService.Timeout = WebBrowser.Timeout; + KeyValue? response = null; for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) { @@ -1719,10 +1723,6 @@ public sealed class ArchiWebHandler : IDisposable { await Task.Delay(WebLimiterDelay).ConfigureAwait(false); } - using WebAPI.AsyncInterface econService = Bot.SteamConfiguration.GetAsyncWebAPIInterface(EconService); - - econService.Timeout = WebBrowser.Timeout; - try { response = await WebLimitRequest( WebAPI.DefaultBaseAddress,