Record input from the user in the logs as well

This commit is contained in:
Łukasz Domeradzki
2025-01-27 19:57:42 +01:00
parent ec151c383b
commit 67c2e9c6d3
2 changed files with 20 additions and 0 deletions

View File

@@ -792,4 +792,8 @@ Process uptime: {1}</value>
<data name="CustomPluginUpdatesEnabled" xml:space="preserve">
<value>Custom plugins have been registered for automatic updates. ASF team would like to remind you that, for your own safety, you should enable automatic updates only from trusted parties. If you didn't intend to do this, you can disable plugin updates in ASF global config.</value>
</data>
<data name="Input" xml:space="preserve">
<value>Input: {0}</value>
<comment>{0} will be replaced by text input from the user.</comment>
</data>
</root>

View File

@@ -106,6 +106,8 @@ internal static class Logging {
Console.Write(cryptKeyText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
break;
case ASF.EUserInputType.DeviceConfirmation:
string deviceConfirmationText = Bot.FormatBotResponse(Strings.UserInputDeviceConfirmation, botName);
@@ -116,6 +118,8 @@ internal static class Logging {
Console.Write(deviceConfirmationText);
result = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
if (string.IsNullOrEmpty(result) || result.Equals("Y", StringComparison.OrdinalIgnoreCase) || result.Equals("N", StringComparison.OrdinalIgnoreCase)) {
break;
}
@@ -130,6 +134,8 @@ internal static class Logging {
Console.Write(loginText);
result = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
break;
case ASF.EUserInputType.Password:
string passwordText = Bot.FormatBotResponse(Strings.UserInputSteamPassword, botName);
@@ -139,6 +145,8 @@ internal static class Logging {
Console.Write(passwordText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
break;
case ASF.EUserInputType.SteamGuard:
string steamGuardText = Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName);
@@ -148,6 +156,8 @@ internal static class Logging {
Console.Write(steamGuardText);
result = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
break;
case ASF.EUserInputType.SteamParentalCode:
string steamParentalCodeText = Bot.FormatBotResponse(Strings.UserInputSteamParentalCode, botName);
@@ -157,6 +167,8 @@ internal static class Logging {
Console.Write(steamParentalCodeText);
result = ConsoleReadLineMasked();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
break;
case ASF.EUserInputType.TwoFactorAuthentication:
string twoFactorAuthenticationText = Bot.FormatBotResponse(Strings.UserInputSteam2FA, botName);
@@ -166,6 +178,8 @@ internal static class Logging {
Console.Write(twoFactorAuthenticationText);
result = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
break;
default:
ASF.ArchiLogger.LogGenericError(Strings.FormatWarningUnknownValuePleaseReport(nameof(userInputType), userInputType));
@@ -423,6 +437,8 @@ internal static class Logging {
Console.Write(enterCommandText);
string? command = ConsoleReadLine();
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(command));
if (string.IsNullOrEmpty(command)) {
continue;
}