mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Allow cmdline arg for forbidding Steam parental generation
This commit is contained in:
@@ -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<PosixSignal, PosixSignalRegistration> 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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user