From 44bea852968a52ff0dde026832fd18b7cacb60a0 Mon Sep 17 00:00:00 2001 From: Archi Date: Wed, 20 Mar 2024 21:51:28 +0100 Subject: [PATCH] Fix and derequire type text in confirmation Even if we have it always available, we don't need use it 99.9% of time, and even in 0.1% it's only supportive attribute for debugging. Make it optional, will help with robustness. --- ArchiSteamFarm/Steam/Data/Confirmation.cs | 5 ++--- ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ArchiSteamFarm/Steam/Data/Confirmation.cs b/ArchiSteamFarm/Steam/Data/Confirmation.cs index d0311ac62b9d2..698a31832a772 100644 --- a/ArchiSteamFarm/Steam/Data/Confirmation.cs +++ b/ArchiSteamFarm/Steam/Data/Confirmation.cs @@ -36,9 +36,8 @@ public sealed class Confirmation { public EConfirmationType ConfirmationType { get; private init; } [JsonInclude] - [JsonPropertyName("type_text")] - [JsonRequired] - public string ConfirmationTypeText { get; private init; } = ""; + [JsonPropertyName("type_name")] + public string? ConfirmationTypeName { get; private init; } [JsonInclude] [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] diff --git a/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs b/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs index bbe67f0ef55cd..efc20b3ce2b63 100644 --- a/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs +++ b/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs @@ -183,7 +183,7 @@ public sealed class MobileAuthenticator : IDisposable { } foreach (Confirmation? confirmation in response.Confirmations.Where(static confirmation => (confirmation.ConfirmationType == Confirmation.EConfirmationType.Unknown) || !Enum.IsDefined(confirmation.ConfirmationType))) { - Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(confirmation.ConfirmationType), $"{confirmation.ConfirmationType} ({confirmation.ConfirmationTypeText})")); + Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(confirmation.ConfirmationType), $"{confirmation.ConfirmationType} ({confirmation.ConfirmationTypeName ?? "null"})")); } return response.Confirmations;