mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Fix accepting over 30 confirmations
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -55,6 +56,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
private const byte CodeDigits = 5;
|
private const byte CodeDigits = 5;
|
||||||
private const byte CodeInterval = 30;
|
private const byte CodeInterval = 30;
|
||||||
|
private const byte MaxConfirmationsPerRequest = 30; // This is limit enforced by Valve
|
||||||
|
|
||||||
private static readonly char[] CodeCharacters = {
|
private static readonly char[] CodeCharacters = {
|
||||||
'2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C',
|
'2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C',
|
||||||
@@ -115,12 +117,28 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string confirmationHash = GenerateConfirmationKey(time, "conf");
|
string confirmationHash = GenerateConfirmationKey(time, "conf");
|
||||||
if (!string.IsNullOrEmpty(confirmationHash)) {
|
if (string.IsNullOrEmpty(confirmationHash)) {
|
||||||
|
Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (confirmations.Count <= MaxConfirmationsPerRequest) {
|
||||||
return await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, confirmations, accept).ConfigureAwait(false);
|
return await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, confirmations, accept).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
|
HashSet<Confirmation> pendingConfirmations = new HashSet<Confirmation>(confirmations);
|
||||||
return false;
|
|
||||||
|
do {
|
||||||
|
HashSet<Confirmation> currentConfirmations = new HashSet<Confirmation>(pendingConfirmations.Take(MaxConfirmationsPerRequest));
|
||||||
|
|
||||||
|
if (!await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, currentConfirmations, accept).ConfigureAwait(false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingConfirmations.ExceptWith(currentConfirmations);
|
||||||
|
} while (pendingConfirmations.Count > 0);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<Steam.ConfirmationDetails> GetConfirmationDetails(Confirmation confirmation) {
|
internal async Task<Steam.ConfirmationDetails> GetConfirmationDetails(Confirmation confirmation) {
|
||||||
|
|||||||
Reference in New Issue
Block a user