From 877ff39b830528eafc1d2f2d292616df5914e349 Mon Sep 17 00:00:00 2001 From: PWall <34860495+PWall2222@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:59:35 +0100 Subject: [PATCH] fix: detection of tracker.gg closes #8 --- NOWT/Helpers/LiveMatch.cs | 3 ++- NOWT/Helpers/Login.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NOWT/Helpers/LiveMatch.cs b/NOWT/Helpers/LiveMatch.cs index 83b56d7..0f7de11 100644 --- a/NOWT/Helpers/LiveMatch.cs +++ b/NOWT/Helpers/LiveMatch.cs @@ -1140,7 +1140,8 @@ private static async Task TrackerAsync(string username) url.ToString(), false, false, - false + false, + true ) .ConfigureAwait(false); var numericStatusCode = (short)response.StatusCode; diff --git a/NOWT/Helpers/Login.cs b/NOWT/Helpers/Login.cs index 191713f..d2e57bd 100644 --- a/NOWT/Helpers/Login.cs +++ b/NOWT/Helpers/Login.cs @@ -172,7 +172,8 @@ public static async Task DoCachedRequestAsync( string url, bool addRiotAuth, bool bypassCache = false, - bool displayError = true + bool displayError = true, + bool userAgentTrickery = false ) { var attemptCache = method == Method.Get && !bypassCache; @@ -180,6 +181,12 @@ public static async Task DoCachedRequestAsync( if (Constants.UrlToBody.TryGetValue(url, out var res)) return res; var client = new RestClient(url); + + if (userAgentTrickery) + { + client.AddDefaultHeader("User-Agent", "Mozilla/5.0"); + } + var request = new RestRequest(); if (addRiotAuth) {