diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index 0f44729a1..d4d4bd390 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -54,6 +54,7 @@ internal static class Program { internal static bool RestartAllowed { get; private set; } = true; internal static bool Service { get; private set; } internal static bool ShutdownSequenceInitialized { get; private set; } + internal static bool SteamParentalGeneration { get; private set; } = true; #if !NETFRAMEWORK private static readonly Dictionary RegisteredPosixSignals = new(); @@ -529,6 +530,10 @@ internal static class Program { case "--NO-RESTART" when !cryptKeyNext && !networkGroupNext && !pathNext: RestartAllowed = false; + break; + case "--NO-STEAM-PARENTAL-GENERATION" when !cryptKeyNext && !networkGroupNext && !pathNext: + SteamParentalGeneration = false; + break; case "--PROCESS-REQUIRED" when !cryptKeyNext && !networkGroupNext && !pathNext: ProcessRequired = true; diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index d4159cd33..4027eecb9 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2783,7 +2783,7 @@ public sealed class Bot : IAsyncDisposable { } if (callback.ParentalSettings != null) { - (bool isSteamParentalEnabled, string? steamParentalCode) = ValidateSteamParental(callback.ParentalSettings, BotConfig.SteamParentalCode); + (bool isSteamParentalEnabled, string? steamParentalCode) = ValidateSteamParental(callback.ParentalSettings, BotConfig.SteamParentalCode, Program.SteamParentalGeneration); if (isSteamParentalEnabled) { // Steam parental enabled @@ -2801,7 +2801,7 @@ public sealed class Bot : IAsyncDisposable { break; } } - } else if (string.IsNullOrEmpty(BotConfig.SteamParentalCode)) { + } else { // We failed to generate the pin ourselves, ask the user RequiredInput = ASF.EUserInputType.SteamParentalCode; @@ -3503,7 +3503,7 @@ public sealed class Bot : IAsyncDisposable { PlayingWasBlockedTimer = null; } - private (bool IsSteamParentalEnabled, string? SteamParentalCode) ValidateSteamParental(ParentalSettings settings, string? steamParentalCode = null) { + private (bool IsSteamParentalEnabled, string? SteamParentalCode) ValidateSteamParental(ParentalSettings settings, string? steamParentalCode = null, bool allowGeneration = true) { ArgumentNullException.ThrowIfNull(settings); if (!settings.is_enabled) { @@ -3550,6 +3550,10 @@ public sealed class Bot : IAsyncDisposable { } } + if (!allowGeneration) { + return (true, null); + } + ArchiLogger.LogGenericInfo(Strings.BotGeneratingSteamParentalCode); steamParentalCode = ArchiCryptoHelper.RecoverSteamParentalCode(settings.passwordhash, settings.salt, steamParentalHashingMethod);