diff --git a/DiscordChatExporter.Core/Discord/DiscordClient.cs b/DiscordChatExporter.Core/Discord/DiscordClient.cs index 3305af86..c5815f73 100644 --- a/DiscordChatExporter.Core/Discord/DiscordClient.cs +++ b/DiscordChatExporter.Core/Discord/DiscordClient.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -38,22 +37,7 @@ public class DiscordClient( private TokenKind? _resolvedTokenKind; private static string? _xSuperPropertiesHeader; - - private static Guid GenerateLaunchSignature() - { - var bytes = Guid.NewGuid().ToByteArray(); - var bits = new BitArray(bytes); - - // Clear the mod-detection bits - int[] bitPositions = [119, 108, 100, 91, 84, 75, 61, 55, 48, 38, 24, 11]; - foreach (int bit in bitPositions) - bits[bit] = false; - - bits.CopyTo(bytes, 0); - - return new Guid(bytes); - } - + // We could generate a random UserAgent. However, that way we could run into issues where certain older or newer versions // and certain browsers could trigger experimental or unsupported features on Discord's site, resulting in the requests potentially failing, // creating impossible to replicate issues for users @@ -64,7 +48,6 @@ public class DiscordClient( CancellationToken cancellationToken = default ) { - //var launchSignature = GenerateLaunchSignature(); var buildNumber = await GetBuildNumberAsync(); if (buildNumber == null) @@ -73,7 +56,7 @@ public class DiscordClient( // https://github.com/greg6775/Discord-Api-Endpoints/blob/master/README.md // https://docs.discord.food/reference#client-properties var json = JsonSerializer.Serialize( - new XSuperProperties("Linux", buildNumber ?? ""), // Operating System based on UserAgent + new XSuperProperties("Linux", buildNumber), // Operating System based on UserAgent XSuperPropertiesJsonContext.Default.XSuperProperties ); @@ -86,12 +69,13 @@ public class DiscordClient( var response = await Http.Client.SendAsync( request, - HttpCompletionOption.ResponseHeadersRead, + HttpCompletionOption.ResponseContentRead, cancellationToken ); var responseBody = await response.Content.ReadAsStringAsync(cancellationToken); // Parse BUILD_NUMBER from the response body + // Example being: "