Skip to content

Commit

Permalink
Handle new no requirements for API key
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Dec 3, 2023
1 parent def3e26 commit 0095d45
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,7 @@ internal async Task<bool> UnpackBooster(uint appID, ulong itemID) {
return (ESteamApiKeyState.AccessDenied, null);
}

INode? htmlNode = response.Content.SelectSingleNode("//div[@id='bodyContents_ex']/p");
INode? htmlNode = response.Content.SelectSingleNode("//div[@id='bodyContents_ex']//p");

if (htmlNode == null) {
Bot.ArchiLogger.LogNullError(htmlNode);
Expand All @@ -2381,6 +2381,10 @@ internal async Task<bool> UnpackBooster(uint appID, ulong itemID) {
return (ESteamApiKeyState.Error, null);
}

if (text.Contains("Your account does not meet the requirements", StringComparison.OrdinalIgnoreCase)) {
return (ESteamApiKeyState.RequirementsNotMet, null);
}

if (text.Contains("Registering for a Steam Web API Key", StringComparison.OrdinalIgnoreCase)) {
return (ESteamApiKeyState.NotRegisteredYet, null);
}
Expand Down Expand Up @@ -2695,6 +2699,7 @@ private async Task<bool> RefreshSession() {

return (true, key);
case ESteamApiKeyState.NotRegisteredYet:
case ESteamApiKeyState.RequirementsNotMet:
// Registration of key requires active ASF 2FA, or user interaction
// Show a warning but don't cache this, we expect this to be temporary
Bot.ArchiLogger.LogGenericWarning(Strings.BotWarningNoApiKeyRegistered);
Expand Down Expand Up @@ -2872,6 +2877,7 @@ private enum ESteamApiKeyState : byte {
Timeout,
Registered,
NotRegisteredYet,
AccessDenied
AccessDenied,
RequirementsNotMet
}
}

0 comments on commit 0095d45

Please sign in to comment.