From dba09a606fa3fd586149d7f677910e64de0babf1 Mon Sep 17 00:00:00 2001 From: PWall <34860495+PWall2222@users.noreply.github.com> Date: Wed, 17 Apr 2024 23:58:24 +0200 Subject: [PATCH] fix: add missing headers --- NOWT/Helpers/Checks.cs | 8 ++++++-- NOWT/Helpers/LiveMatch.cs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NOWT/Helpers/Checks.cs b/NOWT/Helpers/Checks.cs index 2a18cb4..896200d 100644 --- a/NOWT/Helpers/Checks.cs +++ b/NOWT/Helpers/Checks.cs @@ -14,11 +14,13 @@ public static async Task CheckLoginAsync() return false; var client = new RestClient( $"https://pd.{Constants.Region}.a.pvp.net/account-xp/v1/players/{Constants.Ppuuid}" - ); + ); var request = new RestRequest() .AddHeader("Authorization", $"Bearer {Constants.AccessToken}") - .AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); + .AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken) + .AddHeader("X-Riot-ClientPlatform", Constants.Platform) + .AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client.ExecuteGetAsync(request).ConfigureAwait(false); if (response.IsSuccessful) return true; @@ -68,6 +70,8 @@ public static async Task CheckMatchAsync() var request = new RestRequest(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); + request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client.ExecuteGetAsync(request).ConfigureAwait(false); if (response.IsSuccessful) return true; diff --git a/NOWT/Helpers/LiveMatch.cs b/NOWT/Helpers/LiveMatch.cs index e68c1b2..26da13f 100644 --- a/NOWT/Helpers/LiveMatch.cs +++ b/NOWT/Helpers/LiveMatch.cs @@ -35,6 +35,8 @@ private static async Task CheckAndSetLiveMatchIdAsync() var request = new RestRequest(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); + request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client.ExecuteGetAsync(request).ConfigureAwait(false); if (response.IsSuccessful) { @@ -69,6 +71,7 @@ public async Task CheckAndSetPartyIdAsync() var request = new RestRequest(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client.ExecuteGetAsync(request).ConfigureAwait(false); if (!response.IsSuccessful) @@ -103,6 +106,8 @@ private static async Task GetLiveMatchDetailsAsync() RestRequest request = new(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); + request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client .ExecuteGetAsync(request) .ConfigureAwait(false); @@ -124,6 +129,8 @@ private static async Task GetPreMatchDetailsAsync() RestRequest request = new(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); + request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client .ExecuteGetAsync(request) .ConfigureAwait(false); @@ -145,6 +152,8 @@ private static async Task GetPartyDetailsAsync() RestRequest request = new(); request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken); request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}"); + request.AddHeader("X-Riot-ClientPlatform", Constants.Platform); + request.AddHeader("X-Riot-ClientVersion", Constants.Version); var response = await client.ExecuteGetAsync(request).ConfigureAwait(false); if (response.IsSuccessful) return response.Data;