diff --git a/MixItUp.Base/Services/MixItUpService.cs b/MixItUp.Base/Services/MixItUpService.cs index 11b8fe854..b08b3c698 100644 --- a/MixItUp.Base/Services/MixItUpService.cs +++ b/MixItUp.Base/Services/MixItUpService.cs @@ -20,6 +20,7 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -610,6 +611,9 @@ private async Task CheckForNewNotifications() { using (AdvancedHttpClient client = new AdvancedHttpClient(UtilApiEndpoint)) { + client.DefaultRequestHeaders.Add("User-Agent", $"MixItUp/{Assembly.GetEntryAssembly().GetName().Version.ToString()} (Web call from Mix It Up; https://mixitupapp.com; support@mixitupapp.com)"); + client.DefaultRequestHeaders.Add("Client-Key", UtilServiceHelper.GenerateClientKey()); + HttpResponseMessage response = await client.GetAsync("api/services/notifications/id"); if (response.StatusCode == HttpStatusCode.OK) { @@ -656,6 +660,9 @@ public async Task> GetNotifications() { using (AdvancedHttpClient client = new AdvancedHttpClient(UtilApiEndpoint)) { + client.DefaultRequestHeaders.Add("User-Agent", $"MixItUp/{Assembly.GetEntryAssembly().GetName().Version.ToString()} (Web call from Mix It Up; https://mixitupapp.com; support@mixitupapp.com)"); + client.DefaultRequestHeaders.Add("Client-Key", UtilServiceHelper.GenerateClientKey()); + HttpResponseMessage response = await client.GetAsync("/api/services/notifications"); if (response.StatusCode == HttpStatusCode.OK) { @@ -712,6 +719,9 @@ public async Task CheckOutageStatus() { using (AdvancedHttpClient client = new AdvancedHttpClient(UtilApiEndpoint)) { + client.DefaultRequestHeaders.Add("User-Agent", $"MixItUp/{Assembly.GetEntryAssembly().GetName().Version.ToString()} (Web call from Mix It Up; https://mixitupapp.com; support@mixitupapp.com)"); + client.DefaultRequestHeaders.Add("Client-Key", UtilServiceHelper.GenerateClientKey()); + HttpResponseMessage response = await client.GetAsync("api/services/notifications/outage"); if (response.StatusCode == HttpStatusCode.OK) {