mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
STD: Fail on invalid tokens
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
||||
internal static class SharedInfo {
|
||||
internal const byte ApiVersion = 1;
|
||||
internal const string ConfigurationPropertyEnabled = nameof(SteamTokenDumperPlugin) + "Enabled";
|
||||
internal const ushort ItemsPerSingleRequest = 2048; // Should be synchronized with TimeoutForLongRunningTasksInSeconds
|
||||
internal const byte MaximumHoursBetweenRefresh = 8; // Per single bot account, makes sense to be 2 or 3 times less than MinimumHoursBetweenUploads
|
||||
internal const byte MaximumMinutesBeforeFirstUpload = 60; // Must be greater or equal to MinimumMinutesBeforeFirstUpload
|
||||
@@ -30,5 +31,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
||||
internal const string ServerURL = "https://asf-token-dumper.xpaw.me";
|
||||
internal const byte TimeoutForLongRunningTasksInSeconds = 60; // Should be synchronized with ItemsPerSingleRequest
|
||||
internal const string Token = "STEAM_TOKEN_DUMPER_TOKEN";
|
||||
|
||||
internal static bool HasValidToken => Token.Length == 128;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +52,18 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
||||
public Task<uint> GetPreferredChangeNumberToStartFrom() => Task.FromResult(IsEnabled ? GlobalCache?.LastChangeNumber ?? 0 : 0);
|
||||
|
||||
public void OnASFInit(IReadOnlyDictionary<string, JToken> additionalConfigProperties = null) {
|
||||
const string enabledProperty = nameof(SteamTokenDumperPlugin) + "Enabled";
|
||||
if (!SharedInfo.HasValidToken) {
|
||||
ASF.ArchiLogger.LogGenericError($"{Name} has been disabled due to missing build token.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled = false;
|
||||
|
||||
if (additionalConfigProperties != null) {
|
||||
foreach ((string configProperty, JToken configValue) in additionalConfigProperties) {
|
||||
try {
|
||||
if (configProperty == enabledProperty) {
|
||||
if (configProperty == SharedInfo.ConfigurationPropertyEnabled) {
|
||||
enabled = configValue.Value<bool>();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user