SteamParentalPIN -> SteamParentalCode + fixes for @Aareksio

This commit is contained in:
JustArchi
2018-09-22 15:50:11 +02:00
parent dfc8473680
commit bd2e146bef
15 changed files with 154 additions and 139 deletions

View File

@@ -615,7 +615,7 @@ namespace ArchiSteamFarm {
Login, Login,
Password, Password,
SteamGuard, SteamGuard,
SteamParentalPIN, SteamParentalCode,
TwoFactorAuthentication TwoFactorAuthentication
} }
} }

View File

@@ -1025,9 +1025,9 @@ namespace ArchiSteamFarm {
internal async Task<bool> HasValidApiKey() => !string.IsNullOrEmpty(await GetApiKey().ConfigureAwait(false)); internal async Task<bool> HasValidApiKey() => !string.IsNullOrEmpty(await GetApiKey().ConfigureAwait(false));
internal async Task<bool> Init(ulong steamID, EUniverse universe, string webAPIUserNonce, string parentalPin) { internal async Task<bool> Init(ulong steamID, EUniverse universe, string webAPIUserNonce, string parentalCode = null) {
if ((steamID == 0) || (universe == EUniverse.Invalid) || string.IsNullOrEmpty(webAPIUserNonce) || string.IsNullOrEmpty(parentalPin)) { if ((steamID == 0) || (universe == EUniverse.Invalid) || string.IsNullOrEmpty(webAPIUserNonce)) {
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(universe) + " || " + nameof(webAPIUserNonce) + " || " + nameof(parentalPin)); Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(universe) + " || " + nameof(webAPIUserNonce));
return false; return false;
} }
@@ -1109,8 +1109,8 @@ namespace ArchiSteamFarm {
Bot.ArchiLogger.LogGenericInfo(Strings.Success); Bot.ArchiLogger.LogGenericInfo(Strings.Success);
// Unlock Steam Parental if needed // Unlock Steam Parental if needed
if (!parentalPin.Equals("0")) { if (!string.IsNullOrEmpty(parentalCode) && (parentalCode.Length == 4)) {
if (!await UnlockParentalAccount(parentalPin).ConfigureAwait(false)) { if (!await UnlockParentalAccount(parentalCode).ConfigureAwait(false)) {
return false; return false;
} }
} }
@@ -1622,20 +1622,20 @@ namespace ArchiSteamFarm {
return await UrlPostWithSession(SteamCommunityURL, request, data).ConfigureAwait(false); return await UrlPostWithSession(SteamCommunityURL, request, data).ConfigureAwait(false);
} }
private async Task<bool> UnlockParentalAccount(string parentalPin) { private async Task<bool> UnlockParentalAccount(string parentalCode) {
if (string.IsNullOrEmpty(parentalPin)) { if (string.IsNullOrEmpty(parentalCode)) {
Bot.ArchiLogger.LogNullError(nameof(parentalPin)); Bot.ArchiLogger.LogNullError(nameof(parentalCode));
return false; return false;
} }
Bot.ArchiLogger.LogGenericInfo(Strings.UnlockingParentalAccount); Bot.ArchiLogger.LogGenericInfo(Strings.UnlockingParentalAccount);
if (!await UnlockParentalAccountForService(SteamCommunityURL, parentalPin).ConfigureAwait(false)) { if (!await UnlockParentalAccountForService(SteamCommunityURL, parentalCode).ConfigureAwait(false)) {
Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed); Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed);
return false; return false;
} }
if (!await UnlockParentalAccountForService(SteamStoreURL, parentalPin).ConfigureAwait(false)) { if (!await UnlockParentalAccountForService(SteamStoreURL, parentalCode).ConfigureAwait(false)) {
Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed); Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed);
return false; return false;
} }
@@ -1644,9 +1644,9 @@ namespace ArchiSteamFarm {
return true; return true;
} }
private async Task<bool> UnlockParentalAccountForService(string serviceURL, string parentalPin, byte maxTries = WebBrowser.MaxTries) { private async Task<bool> UnlockParentalAccountForService(string serviceURL, string parentalCode, byte maxTries = WebBrowser.MaxTries) {
if (string.IsNullOrEmpty(serviceURL) || string.IsNullOrEmpty(parentalPin)) { if (string.IsNullOrEmpty(serviceURL) || string.IsNullOrEmpty(parentalCode)) {
Bot.ArchiLogger.LogNullError(nameof(serviceURL) + " || " + nameof(parentalPin)); Bot.ArchiLogger.LogNullError(nameof(serviceURL) + " || " + nameof(parentalCode));
return false; return false;
} }
@@ -1658,7 +1658,7 @@ namespace ArchiSteamFarm {
return false; return false;
} }
Dictionary<string, string> data = new Dictionary<string, string>(1) { { "pin", parentalPin } }; Dictionary<string, string> data = new Dictionary<string, string>(1) { { "pin", parentalCode } };
// This request doesn't go through UrlPostRetryWithSession as we have no access to session refresh capability (this is in fact session initialization) // This request doesn't go through UrlPostRetryWithSession as we have no access to session refresh capability (this is in fact session initialization)
WebBrowser.BasicResponse response = await WebLimitRequest(serviceURL, async () => await WebBrowser.UrlPost(serviceURL + request, data, serviceURL).ConfigureAwait(false)).ConfigureAwait(false); WebBrowser.BasicResponse response = await WebLimitRequest(serviceURL, async () => await WebBrowser.UrlPost(serviceURL + request, data, serviceURL).ConfigureAwait(false)).ConfigureAwait(false);
@@ -1670,7 +1670,7 @@ namespace ArchiSteamFarm {
// Under special brain-damaged circumstances, Steam might just return our own profile as a response to the request, for absolutely no reason whatsoever - just try again in this case // Under special brain-damaged circumstances, Steam might just return our own profile as a response to the request, for absolutely no reason whatsoever - just try again in this case
if (await IsProfileUri(response.FinalUri, false).ConfigureAwait(false)) { if (await IsProfileUri(response.FinalUri, false).ConfigureAwait(false)) {
Bot.ArchiLogger.LogGenericDebug(string.Format(Strings.WarningWorkaroundTriggered, nameof(IsProfileUri))); Bot.ArchiLogger.LogGenericDebug(string.Format(Strings.WarningWorkaroundTriggered, nameof(IsProfileUri)));
return await UnlockParentalAccountForService(serviceURL, parentalPin, --maxTries).ConfigureAwait(false); return await UnlockParentalAccountForService(serviceURL, parentalCode, --maxTries).ConfigureAwait(false);
} }
return true; return true;

View File

@@ -828,7 +828,7 @@ namespace ArchiSteamFarm {
return false; return false;
} }
if (await ArchiWebHandler.Init(CachedSteamID, SteamClient.Universe, callback.Nonce, BotConfig.SteamParentalPIN).ConfigureAwait(false)) { if (await ArchiWebHandler.Init(CachedSteamID, SteamClient.Universe, callback.Nonce, BotConfig.SteamParentalCode).ConfigureAwait(false)) {
return true; return true;
} }
@@ -987,16 +987,16 @@ namespace ArchiSteamFarm {
break; break;
case ASF.EUserInputType.Password: case ASF.EUserInputType.Password:
if (BotConfig != null) { if (BotConfig != null) {
BotConfig.OriginalSteamPassword = inputValue; BotConfig.DecryptedSteamPassword = inputValue;
} }
break; break;
case ASF.EUserInputType.SteamGuard: case ASF.EUserInputType.SteamGuard:
AuthCode = inputValue; AuthCode = inputValue;
break; break;
case ASF.EUserInputType.SteamParentalPIN: case ASF.EUserInputType.SteamParentalCode:
if (BotConfig != null) { if (BotConfig != null) {
BotConfig.SteamParentalPIN = inputValue; BotConfig.SteamParentalCode = inputValue;
} }
break; break;
@@ -1352,7 +1352,7 @@ namespace ArchiSteamFarm {
SetUserInput(ASF.EUserInputType.Login, steamLogin); SetUserInput(ASF.EUserInputType.Login, steamLogin);
} }
if (requiresPassword && string.IsNullOrEmpty(BotConfig.OriginalSteamPassword)) { if (requiresPassword && string.IsNullOrEmpty(BotConfig.DecryptedSteamPassword)) {
string steamPassword = Program.GetUserInput(ASF.EUserInputType.Password, BotName); string steamPassword = Program.GetUserInput(ASF.EUserInputType.Password, BotName);
if (string.IsNullOrEmpty(steamPassword)) { if (string.IsNullOrEmpty(steamPassword)) {
return false; return false;
@@ -1536,7 +1536,7 @@ namespace ArchiSteamFarm {
string username = Regex.Replace(BotConfig.SteamLogin, nonAsciiPattern, "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); string username = Regex.Replace(BotConfig.SteamLogin, nonAsciiPattern, "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
string password = BotConfig.OriginalSteamPassword; string password = BotConfig.DecryptedSteamPassword;
if (!string.IsNullOrEmpty(password)) { if (!string.IsNullOrEmpty(password)) {
password = Regex.Replace(password, nonAsciiPattern, "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); password = Regex.Replace(password, nonAsciiPattern, "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
} }
@@ -1916,19 +1916,19 @@ namespace ArchiSteamFarm {
} }
} }
if (string.IsNullOrEmpty(BotConfig.SteamParentalPIN)) { if (!string.IsNullOrEmpty(BotConfig.SteamParentalCode) && (BotConfig.SteamParentalCode.Length != 4)) {
string steamParentalPIN = Program.GetUserInput(ASF.EUserInputType.SteamParentalPIN, BotName); string steamParentalCode = Program.GetUserInput(ASF.EUserInputType.SteamParentalCode, BotName);
if (string.IsNullOrEmpty(steamParentalPIN)) { if (string.IsNullOrEmpty(steamParentalCode) || (steamParentalCode.Length != 4)) {
Stop(); Stop();
break; break;
} }
SetUserInput(ASF.EUserInputType.SteamParentalPIN, steamParentalPIN); SetUserInput(ASF.EUserInputType.SteamParentalCode, steamParentalCode);
} }
ArchiWebHandler.OnVanityURLChanged(callback.VanityURL); ArchiWebHandler.OnVanityURLChanged(callback.VanityURL);
if (!await ArchiWebHandler.Init(callback.ClientSteamID, SteamClient.Universe, callback.WebAPIUserNonce, BotConfig.SteamParentalPIN).ConfigureAwait(false)) { if (!await ArchiWebHandler.Init(callback.ClientSteamID, SteamClient.Universe, callback.WebAPIUserNonce, BotConfig.SteamParentalCode).ConfigureAwait(false)) {
if (!await RefreshSession().ConfigureAwait(false)) { if (!await RefreshSession().ConfigureAwait(false)) {
break; break;
} }

View File

@@ -52,7 +52,7 @@ namespace ArchiSteamFarm {
private const bool DefaultShutdownOnFarmingFinished = false; private const bool DefaultShutdownOnFarmingFinished = false;
private const string DefaultSteamLogin = null; private const string DefaultSteamLogin = null;
private const ulong DefaultSteamMasterClanID = 0; private const ulong DefaultSteamMasterClanID = 0;
private const string DefaultSteamParentalPIN = "0"; private const string DefaultSteamParentalCode = null;
private const string DefaultSteamPassword = null; private const string DefaultSteamPassword = null;
private const string DefaultSteamTradeToken = null; private const string DefaultSteamTradeToken = null;
private const ETradingPreferences DefaultTradingPreferences = ETradingPreferences.None; private const ETradingPreferences DefaultTradingPreferences = ETradingPreferences.None;
@@ -138,6 +138,97 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)] [JsonProperty(Required = Required.DisallowNull)]
internal readonly bool UseLoginKeys = DefaultUseLoginKeys; internal readonly bool UseLoginKeys = DefaultUseLoginKeys;
internal string DecryptedSteamPassword {
get {
if (string.IsNullOrEmpty(SteamPassword)) {
return null;
}
if (PasswordFormat == ArchiCryptoHelper.ECryptoMethod.PlainText) {
return SteamPassword;
}
string decryptedPassword = ArchiCryptoHelper.Decrypt(PasswordFormat, SteamPassword);
if (string.IsNullOrEmpty(decryptedPassword)) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, nameof(SteamPassword)));
return null;
}
return decryptedPassword;
}
set {
if (string.IsNullOrEmpty(value)) {
ASF.ArchiLogger.LogNullError(nameof(value));
return;
}
SteamPassword = PasswordFormat == ArchiCryptoHelper.ECryptoMethod.PlainText ? value : ArchiCryptoHelper.Encrypt(PasswordFormat, value);
}
}
internal bool IsSteamLoginSet { get; private set; }
internal bool IsSteamParentalCodeSet { get; private set; }
internal bool IsSteamPasswordSet { get; private set; }
internal bool ShouldSerializeEverything { private get; set; } = true;
[JsonProperty]
internal string SteamLogin {
get => _SteamLogin;
set {
IsSteamLoginSet = true;
_SteamLogin = value;
}
}
[JsonProperty(Required = Required.DisallowNull)]
internal ulong SteamMasterClanID { get; private set; } = DefaultSteamMasterClanID;
[JsonProperty]
internal string SteamParentalCode {
get => _SteamParentalCode;
set {
IsSteamParentalCodeSet = true;
_SteamParentalCode = value;
}
}
[JsonProperty]
internal string SteamPassword {
get => _SteamPassword;
set {
IsSteamPasswordSet = true;
_SteamPassword = value;
}
}
private string _SteamLogin = DefaultSteamLogin;
private string _SteamParentalCode = DefaultSteamParentalCode;
private string _SteamPassword = DefaultSteamPassword;
private bool ShouldSerializeSensitiveDetails = true;
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamMasterClanID), Required = Required.DisallowNull)]
private string SSteamMasterClanID {
get => SteamMasterClanID.ToString();
set {
if (string.IsNullOrEmpty(value) || !ulong.TryParse(value, out ulong result)) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, nameof(SSteamMasterClanID)));
return;
}
SteamMasterClanID = result;
}
}
[JsonProperty]
private string SteamParentalPIN {
set {
if (string.IsNullOrEmpty(value) || (value != "0")) {
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(SteamParentalPIN), nameof(SteamParentalCode)));
SteamParentalCode = string.IsNullOrEmpty(value) ? "0" : value;
}
}
}
internal (bool Valid, string ErrorMessage) CheckValidation() { internal (bool Valid, string ErrorMessage) CheckValidation() {
if (BotBehaviour > EBotBehaviour.All) { if (BotBehaviour > EBotBehaviour.All) {
return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(BotBehaviour), BotBehaviour)); return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(BotBehaviour), BotBehaviour));
@@ -181,6 +272,10 @@ namespace ArchiSteamFarm {
return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(SteamMasterClanID), SteamMasterClanID)); return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(SteamMasterClanID), SteamMasterClanID));
} }
if (!string.IsNullOrEmpty(SteamParentalCode) && (SteamParentalCode != "0") && (SteamParentalCode.Length != 4)) {
return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(SteamParentalCode), SteamParentalCode));
}
foreach (EPermission permission in SteamUserPermissions.Values.Where(permission => !Enum.IsDefined(typeof(EPermission), permission))) { foreach (EPermission permission in SteamUserPermissions.Values.Where(permission => !Enum.IsDefined(typeof(EPermission), permission))) {
return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(SteamUserPermissions), permission)); return (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(SteamUserPermissions), permission));
} }
@@ -188,63 +283,6 @@ namespace ArchiSteamFarm {
return TradingPreferences <= ETradingPreferences.All ? (true, null) : (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(TradingPreferences), TradingPreferences)); return TradingPreferences <= ETradingPreferences.All ? (true, null) : (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(TradingPreferences), TradingPreferences));
} }
internal string OriginalSteamPassword {
get {
if (string.IsNullOrEmpty(SteamPassword)) {
return null;
}
if (PasswordFormat == ArchiCryptoHelper.ECryptoMethod.PlainText) {
return SteamPassword;
}
string decryptedPassword = ArchiCryptoHelper.Decrypt(PasswordFormat, SteamPassword);
if (string.IsNullOrEmpty(decryptedPassword)) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, nameof(SteamPassword)));
return null;
}
return decryptedPassword;
}
set {
if (string.IsNullOrEmpty(value)) {
ASF.ArchiLogger.LogNullError(nameof(value));
return;
}
SteamPassword = PasswordFormat == ArchiCryptoHelper.ECryptoMethod.PlainText ? value : ArchiCryptoHelper.Encrypt(PasswordFormat, value);
}
}
internal bool ShouldSerializeEverything { private get; set; } = true;
[JsonProperty]
internal string SteamLogin { get; set; } = DefaultSteamLogin;
[JsonProperty(Required = Required.DisallowNull)]
internal ulong SteamMasterClanID { get; private set; } = DefaultSteamMasterClanID;
[JsonProperty]
internal string SteamParentalPIN { get; set; } = DefaultSteamParentalPIN;
private bool ShouldSerializeSensitiveDetails = true;
[JsonProperty]
private string SteamPassword = DefaultSteamPassword;
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamMasterClanID), Required = Required.DisallowNull)]
private string SSteamMasterClanID {
get => SteamMasterClanID.ToString();
set {
if (string.IsNullOrEmpty(value) || !ulong.TryParse(value, out ulong result)) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, nameof(SSteamMasterClanID)));
return;
}
SteamMasterClanID = result;
}
}
internal static async Task<BotConfig> Load(string filePath) { internal static async Task<BotConfig> Load(string filePath) {
if (string.IsNullOrEmpty(filePath)) { if (string.IsNullOrEmpty(filePath)) {
ASF.ArchiLogger.LogNullError(nameof(filePath)); ASF.ArchiLogger.LogNullError(nameof(filePath));
@@ -395,7 +433,7 @@ namespace ArchiSteamFarm {
public bool ShouldSerializeSSteamMasterClanID() => ShouldSerializeEverything; // We never serialize helper properties public bool ShouldSerializeSSteamMasterClanID() => ShouldSerializeEverything; // We never serialize helper properties
public bool ShouldSerializeSteamLogin() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamLogin != DefaultSteamLogin)); public bool ShouldSerializeSteamLogin() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamLogin != DefaultSteamLogin));
public bool ShouldSerializeSteamMasterClanID() => ShouldSerializeEverything || (SteamMasterClanID != DefaultSteamMasterClanID); public bool ShouldSerializeSteamMasterClanID() => ShouldSerializeEverything || (SteamMasterClanID != DefaultSteamMasterClanID);
public bool ShouldSerializeSteamParentalPIN() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamParentalPIN != DefaultSteamParentalPIN)); public bool ShouldSerializeSteamParentalCode() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamParentalCode != DefaultSteamParentalCode));
public bool ShouldSerializeSteamPassword() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamPassword != DefaultSteamPassword)); public bool ShouldSerializeSteamPassword() => ShouldSerializeSensitiveDetails && (ShouldSerializeEverything || (SteamPassword != DefaultSteamPassword));
public bool ShouldSerializeSteamTradeToken() => ShouldSerializeEverything || (SteamTradeToken != DefaultSteamTradeToken); public bool ShouldSerializeSteamTradeToken() => ShouldSerializeEverything || (SteamTradeToken != DefaultSteamTradeToken);
public bool ShouldSerializeSteamUserPermissions() => ShouldSerializeEverything || ((SteamUserPermissions != DefaultSteamUserPermissions) && ((SteamUserPermissions.Count != DefaultSteamUserPermissions.Count) || SteamUserPermissions.Except(DefaultSteamUserPermissions).Any())); public bool ShouldSerializeSteamUserPermissions() => ShouldSerializeEverything || ((SteamUserPermissions != DefaultSteamUserPermissions) && ((SteamUserPermissions.Count != DefaultSteamUserPermissions.Count) || SteamUserPermissions.Except(DefaultSteamUserPermissions).Any()));

View File

@@ -1350,11 +1350,11 @@ namespace ArchiSteamFarm {
return null; return null;
} }
if (string.IsNullOrEmpty(Bot.BotConfig.OriginalSteamPassword)) { if (string.IsNullOrEmpty(Bot.BotConfig.DecryptedSteamPassword)) {
return FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(BotConfig.OriginalSteamPassword))); return FormatBotResponse(string.Format(Strings.ErrorIsEmpty, nameof(BotConfig.DecryptedSteamPassword)));
} }
string response = FormatBotResponse(string.Format(Strings.BotEncryptedPassword, ArchiCryptoHelper.ECryptoMethod.AES, ArchiCryptoHelper.Encrypt(ArchiCryptoHelper.ECryptoMethod.AES, Bot.BotConfig.OriginalSteamPassword))) + FormatBotResponse(string.Format(Strings.BotEncryptedPassword, ArchiCryptoHelper.ECryptoMethod.ProtectedDataForCurrentUser, ArchiCryptoHelper.Encrypt(ArchiCryptoHelper.ECryptoMethod.ProtectedDataForCurrentUser, Bot.BotConfig.OriginalSteamPassword))); string response = FormatBotResponse(string.Format(Strings.BotEncryptedPassword, ArchiCryptoHelper.ECryptoMethod.AES, ArchiCryptoHelper.Encrypt(ArchiCryptoHelper.ECryptoMethod.AES, Bot.BotConfig.DecryptedSteamPassword))) + FormatBotResponse(string.Format(Strings.BotEncryptedPassword, ArchiCryptoHelper.ECryptoMethod.ProtectedDataForCurrentUser, ArchiCryptoHelper.Encrypt(ArchiCryptoHelper.ECryptoMethod.ProtectedDataForCurrentUser, Bot.BotConfig.DecryptedSteamPassword)));
return response; return response;
} }

View File

@@ -183,6 +183,7 @@ namespace ArchiSteamFarm {
} }
} }
internal bool IsWebProxyPasswordSet { get; private set; }
internal bool ShouldSerializeEverything { private get; set; } = true; internal bool ShouldSerializeEverything { private get; set; } = true;
[JsonProperty(Required = Required.DisallowNull)] [JsonProperty(Required = Required.DisallowNull)]
@@ -192,9 +193,16 @@ namespace ArchiSteamFarm {
internal ProtocolTypes SteamProtocols { get; private set; } = DefaultSteamProtocols; internal ProtocolTypes SteamProtocols { get; private set; } = DefaultSteamProtocols;
[JsonProperty] [JsonProperty]
internal string WebProxyPassword { get; set; } = DefaultWebProxyPassword; internal string WebProxyPassword {
get => _WebProxyPassword;
set {
IsWebProxyPasswordSet = true;
_WebProxyPassword = value;
}
}
private WebProxy _WebProxy; private WebProxy _WebProxy;
private string _WebProxyPassword = DefaultWebProxyPassword;
private bool ShouldSerializeSensitiveDetails = true; private bool ShouldSerializeSensitiveDetails = true;
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamOwnerID), Required = Required.DisallowNull)] [JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamOwnerID), Required = Required.DisallowNull)]

View File

@@ -58,10 +58,8 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
return BadRequest(new GenericResponse(false, errorMessage)); return BadRequest(new GenericResponse(false, errorMessage));
} }
if (request.KeepSensitiveDetails) { if (!request.GlobalConfig.IsWebProxyPasswordSet && Program.GlobalConfig.IsWebProxyPasswordSet) {
if (string.IsNullOrEmpty(request.GlobalConfig.WebProxyPassword) && !string.IsNullOrEmpty(Program.GlobalConfig.WebProxyPassword)) { request.GlobalConfig.WebProxyPassword = Program.GlobalConfig.WebProxyPassword;
request.GlobalConfig.WebProxyPassword = Program.GlobalConfig.WebProxyPassword;
}
} }
request.GlobalConfig.ShouldSerializeEverything = false; request.GlobalConfig.ShouldSerializeEverything = false;

View File

@@ -77,17 +77,17 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
return BadRequest(new GenericResponse(false, errorMessage)); return BadRequest(new GenericResponse(false, errorMessage));
} }
if (request.KeepSensitiveDetails && Bot.Bots.TryGetValue(botName, out Bot bot)) { if (Bot.Bots.TryGetValue(botName, out Bot bot)) {
if (string.IsNullOrEmpty(request.BotConfig.SteamLogin) && !string.IsNullOrEmpty(bot.BotConfig.SteamLogin)) { if (!request.BotConfig.IsSteamLoginSet && bot.BotConfig.IsSteamLoginSet) {
request.BotConfig.SteamLogin = bot.BotConfig.SteamLogin; request.BotConfig.SteamLogin = bot.BotConfig.SteamLogin;
} }
if (string.IsNullOrEmpty(request.BotConfig.SteamParentalPIN) && !string.IsNullOrEmpty(bot.BotConfig.SteamParentalPIN)) { if (!request.BotConfig.IsSteamPasswordSet && bot.BotConfig.IsSteamPasswordSet) {
request.BotConfig.SteamParentalPIN = bot.BotConfig.SteamParentalPIN; request.BotConfig.DecryptedSteamPassword = bot.BotConfig.DecryptedSteamPassword;
} }
if (string.IsNullOrEmpty(request.BotConfig.OriginalSteamPassword) && !string.IsNullOrEmpty(bot.BotConfig.OriginalSteamPassword)) { if (!request.BotConfig.IsSteamParentalCodeSet && bot.BotConfig.IsSteamParentalCodeSet) {
request.BotConfig.OriginalSteamPassword = bot.BotConfig.OriginalSteamPassword; request.BotConfig.SteamParentalCode = bot.BotConfig.SteamParentalCode;
} }
} }

View File

@@ -24,7 +24,7 @@ using Newtonsoft.Json;
namespace ArchiSteamFarm.IPC.Requests { namespace ArchiSteamFarm.IPC.Requests {
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class ASFRequest : SensitiveDetailsRequest { public sealed class ASFRequest {
[JsonProperty(Required = Required.Always)] [JsonProperty(Required = Required.Always)]
internal readonly GlobalConfig GlobalConfig; internal readonly GlobalConfig GlobalConfig;

View File

@@ -24,7 +24,7 @@ using Newtonsoft.Json;
namespace ArchiSteamFarm.IPC.Requests { namespace ArchiSteamFarm.IPC.Requests {
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class BotRequest : SensitiveDetailsRequest { public sealed class BotRequest {
[JsonProperty(Required = Required.Always)] [JsonProperty(Required = Required.Always)]
internal readonly BotConfig BotConfig; internal readonly BotConfig BotConfig;

View File

@@ -1,29 +0,0 @@
// _ _ _ ____ _ _____
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
//
// Copyright 2015-2018 Łukasz "JustArchi" Domeradzki
// Contact: JustArchi@JustArchi.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Newtonsoft.Json;
namespace ArchiSteamFarm.IPC.Requests {
public abstract class SensitiveDetailsRequest {
[JsonProperty(Required = Required.DisallowNull)]
internal readonly bool KeepSensitiveDetails = true;
}
}

View File

@@ -1343,11 +1343,11 @@ namespace ArchiSteamFarm.Localization {
} }
/// <summary> /// <summary>
/// Wyszukuje zlokalizowany ciąg podobny do ciągu Please enter Steam parental PIN: . /// Wyszukuje zlokalizowany ciąg podobny do ciągu Please enter Steam parental code: .
/// </summary> /// </summary>
internal static string UserInputSteamParentalPIN { internal static string UserInputSteamParentalCode {
get { get {
return ResourceManager.GetString("UserInputSteamParentalPIN", resourceCulture); return ResourceManager.GetString("UserInputSteamParentalCode", resourceCulture);
} }
} }

View File

@@ -264,8 +264,8 @@ StackTrace:
<value>Please enter your Steam login: </value> <value>Please enter your Steam login: </value>
<comment>Please note that this translation should end with space</comment> <comment>Please note that this translation should end with space</comment>
</data> </data>
<data name="UserInputSteamParentalPIN" xml:space="preserve"> <data name="UserInputSteamParentalCode" xml:space="preserve">
<value>Please enter Steam parental PIN: </value> <value>Please enter Steam parental code: </value>
<comment>Please note that this translation should end with space</comment> <comment>Please note that this translation should end with space</comment>
</data> </data>
<data name="UserInputSteamPassword" xml:space="preserve"> <data name="UserInputSteamPassword" xml:space="preserve">

View File

@@ -98,8 +98,8 @@ namespace ArchiSteamFarm {
Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName)); Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName));
result = Console.ReadLine(); result = Console.ReadLine();
break; break;
case ASF.EUserInputType.SteamParentalPIN: case ASF.EUserInputType.SteamParentalCode:
Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamParentalPIN, botName)); Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamParentalCode, botName));
result = Utilities.ReadLineMasked(); result = Utilities.ReadLineMasked();
break; break;
case ASF.EUserInputType.TwoFactorAuthentication: case ASF.EUserInputType.TwoFactorAuthentication:

View File

@@ -27,7 +27,7 @@
"ShutdownOnFarmingFinished": false, "ShutdownOnFarmingFinished": false,
"SteamLogin": null, "SteamLogin": null,
"SteamMasterClanID": 0, "SteamMasterClanID": 0,
"SteamParentalPIN": "0", "SteamParentalCode": null,
"SteamPassword": null, "SteamPassword": null,
"SteamTradeToken": null, "SteamTradeToken": null,
"SteamUserPermissions": {}, "SteamUserPermissions": {},