mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Partially revert < 5 seconds waits
It seems that Valve actually accepts not one but several tokens generated close to the point of request being sent, so our 2FA code will be always valid for 1-2 more minutes after supposed timeout...
This commit is contained in:
@@ -55,7 +55,6 @@ namespace ArchiSteamFarm {
|
||||
|
||||
private const byte CodeDigits = 5;
|
||||
private const byte CodeInterval = 30;
|
||||
private const byte MinimumTimeLeft = 5;
|
||||
|
||||
private static readonly char[] CodeCharacters = {
|
||||
'2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C',
|
||||
@@ -187,12 +186,12 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal async Task<string> GenerateToken() {
|
||||
Tuple<string, byte> tokenTimePair = await GenerateTokenTimePair().ConfigureAwait(false);
|
||||
if (tokenTimePair != null) {
|
||||
return tokenTimePair.Item1;
|
||||
uint time = await GetSteamTime().ConfigureAwait(false);
|
||||
if (time != 0) {
|
||||
return GenerateTokenForTime(time);
|
||||
}
|
||||
|
||||
Logging.LogNullError(nameof(tokenTimePair), Bot.BotName);
|
||||
Logging.LogNullError(nameof(time), Bot.BotName);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -204,12 +203,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
byte timeLeft = (byte) (CodeInterval - time % CodeInterval);
|
||||
if (timeLeft >= MinimumTimeLeft) {
|
||||
return new Tuple<string, byte>(GenerateTokenForTime(time), timeLeft);
|
||||
}
|
||||
|
||||
await Task.Delay(timeLeft * 1000).ConfigureAwait(false);
|
||||
return new Tuple<string, byte>(GenerateTokenForTime(time + timeLeft), CodeInterval);
|
||||
return new Tuple<string, byte>(GenerateTokenForTime(time), timeLeft);
|
||||
}
|
||||
|
||||
internal async Task<HashSet<Confirmation>> GetConfirmations() {
|
||||
|
||||
Reference in New Issue
Block a user