Compare commits

...

6 Commits

Author SHA1 Message Date
Archi
7a13895429 Fix false positives 2024-02-23 02:49:03 +01:00
Archi
75668ea099 Bump 2024-02-23 02:43:06 +01:00
Archi
d3aa881f55 Fix STD serialization after STJ changes 2024-02-23 02:42:18 +01:00
Archi
33a1fdf556 Misc 2024-02-23 01:18:09 +01:00
Archi
0c848ec366 Misc 2024-02-23 01:15:35 +01:00
Archi
21d4e46b81 Bump 2024-02-22 23:45:13 +01:00
5 changed files with 24 additions and 15 deletions

View File

@@ -30,17 +30,29 @@ using SteamKit2;
namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper.Data;
internal sealed class SubmitRequest {
private readonly ulong SteamID;
#pragma warning disable CA1822 // We can't make it static, STJ doesn't serialize it otherwise
[JsonInclude]
[JsonPropertyName("guid")]
private static string Guid => ASF.GlobalDatabase?.Identifier.ToString("N") ?? throw new InvalidOperationException(nameof(ASF.GlobalDatabase.Identifier));
private string Guid => ASF.GlobalDatabase?.Identifier.ToString("N") ?? throw new InvalidOperationException(nameof(ASF.GlobalDatabase.Identifier));
#pragma warning restore CA1822 // We can't make it static, STJ doesn't serialize it otherwise
[JsonInclude]
[JsonPropertyName("steamid")]
private string SteamIDText => new SteamID(SteamID).Render();
#pragma warning disable CA1822 // We can't make it static, STJ doesn't serialize it otherwise
[JsonInclude]
[JsonPropertyName("token")]
private static string Token => SharedInfo.Token;
private string Token => SharedInfo.Token;
#pragma warning restore CA1822 // We can't make it static, STJ doesn't serialize it otherwise
#pragma warning disable CA1822 // We can't make it static, STJ doesn't serialize it otherwise
[JsonInclude]
[JsonPropertyName("v")]
private static byte Version => SharedInfo.ApiVersion;
private byte Version => SharedInfo.ApiVersion;
#pragma warning restore CA1822 // We can't make it static, STJ doesn't serialize it otherwise
[JsonInclude]
[JsonPropertyName("apps")]
@@ -52,17 +64,11 @@ internal sealed class SubmitRequest {
[JsonRequired]
private ImmutableDictionary<string, string> Depots { get; init; }
private readonly ulong SteamID;
[JsonInclude]
[JsonPropertyName("subs")]
[JsonRequired]
private ImmutableDictionary<string, string> Subs { get; init; }
[JsonInclude]
[JsonPropertyName("steamid")]
private string SteamIDText => new SteamID(SteamID).Render();
internal SubmitRequest(ulong steamID, IReadOnlyCollection<KeyValuePair<uint, ulong>> apps, IReadOnlyCollection<KeyValuePair<uint, ulong>> accessTokens, IReadOnlyCollection<KeyValuePair<uint, string>> depots) {
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
throw new ArgumentOutOfRangeException(nameof(steamID));

View File

@@ -53,7 +53,6 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper;
internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotCommand2, IBotSteamClient, ISteamPICSChanges {
private const ushort DepotsRateLimitingDelay = 500;
[JsonInclude]
internal static SteamTokenDumperConfig? Config { get; private set; }
private static readonly ConcurrentDictionary<Bot, IDisposable> BotSubscriptions = new();

View File

@@ -42,10 +42,10 @@ public static class JsonUtilities {
public static readonly JsonSerializerOptions IndentedJsonSerialierOptions = CreateDefaultJsonSerializerOptions(true);
[PublicAPI]
public static JsonElement ToJsonElement<T>(this T obj, bool writeIndented = false) where T : notnull {
public static JsonElement ToJsonElement<T>(this T obj) where T : notnull {
ArgumentNullException.ThrowIfNull(obj);
return JsonSerializer.SerializeToElement(obj, writeIndented ? IndentedJsonSerialierOptions : DefaultJsonSerialierOptions);
return JsonSerializer.SerializeToElement(obj, DefaultJsonSerialierOptions);
}
[PublicAPI]

View File

@@ -27,6 +27,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text.Json;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Helpers.Json;
using ArchiSteamFarm.IPC.Integration;
@@ -328,8 +329,11 @@ internal sealed class Startup {
mvc.AddJsonOptions(
static options => {
options.JsonSerializerOptions.PropertyNamingPolicy = JsonUtilities.DefaultJsonSerialierOptions.PropertyNamingPolicy;
options.JsonSerializerOptions.TypeInfoResolver = JsonUtilities.DefaultJsonSerialierOptions.TypeInfoResolver;
JsonSerializerOptions jsonSerializerOptions = Debugging.IsUserDebugging ? JsonUtilities.IndentedJsonSerialierOptions : JsonUtilities.DefaultJsonSerialierOptions;
options.JsonSerializerOptions.PropertyNamingPolicy = jsonSerializerOptions.PropertyNamingPolicy;
options.JsonSerializerOptions.TypeInfoResolver = jsonSerializerOptions.TypeInfoResolver;
options.JsonSerializerOptions.WriteIndented = jsonSerializerOptions.WriteIndented;
}
);
}

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>6.0.0.0</Version>
<Version>6.0.0.2</Version>
</PropertyGroup>
<PropertyGroup>