mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Add better handling for database decryption failures
This commit is contained in:
@@ -803,4 +803,8 @@ Process uptime: {1}</value>
|
||||
<data name="WarningNoSystemRequiredLinuxDependencies" xml:space="preserve">
|
||||
<value>You've declared --system-required, although your OS is missing required dependencies for that feature to work. Consider installing dbus, although you can also safely ignore this warning if you do not require inhibition to work properly.</value>
|
||||
</data>
|
||||
<data name="WarningBotDatabaseComponentDecryptionFailed" xml:space="preserve">
|
||||
<value>Decryption of {0} database component has failed. This can be OK if you've just changed your bot's {1}, you should no longer observe this warning on the next run then. Otherwise, you should investigate and find out the exact reason for failure.</value>
|
||||
<comment>{0} will be replaced by bot database component's name (string), {1} will be replaced by bot config component's name (string).</comment>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -2496,10 +2496,22 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
if (BotConfig.PasswordFormat.HasTransformation()) {
|
||||
if (!string.IsNullOrEmpty(accessTokenText)) {
|
||||
accessTokenText = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, accessTokenText).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(accessTokenText)) {
|
||||
BotDatabase.AccessToken = null;
|
||||
|
||||
ArchiLogger.LogGenericWarning(Strings.FormatWarningBotDatabaseComponentDecryptionFailed(nameof(BotDatabase.AccessToken), nameof(BotConfig.PasswordFormat)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(refreshTokenText)) {
|
||||
refreshTokenText = await ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, refreshTokenText).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(refreshTokenText)) {
|
||||
BotDatabase.RefreshToken = null;
|
||||
|
||||
ArchiLogger.LogGenericWarning(Strings.FormatWarningBotDatabaseComponentDecryptionFailed(nameof(BotDatabase.RefreshToken), nameof(BotConfig.PasswordFormat)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user