diff --git a/src/Sidekick.Apis.Poe/Clients/PoeTradeHandler.cs b/src/Sidekick.Apis.Poe/Clients/PoeTradeHandler.cs index 7f81c15d..1b428426 100644 --- a/src/Sidekick.Apis.Poe/Clients/PoeTradeHandler.cs +++ b/src/Sidekick.Apis.Poe/Clients/PoeTradeHandler.cs @@ -18,7 +18,7 @@ public class PoeTradeHandler IGameLanguageProvider gameLanguageProvider ) : DelegatingHandler { - public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"; + public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"; protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { diff --git a/src/Sidekick.Wpf/CloudflareWindow.xaml.cs b/src/Sidekick.Wpf/CloudflareWindow.xaml.cs index 59c97360..6e905f36 100644 --- a/src/Sidekick.Wpf/CloudflareWindow.xaml.cs +++ b/src/Sidekick.Wpf/CloudflareWindow.xaml.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Net; using System.Windows; using System.Windows.Media; using Microsoft.Extensions.Logging; @@ -36,6 +37,7 @@ public void Ready() await WebView.EnsureCoreWebView2Async(); WebView.CoreWebView2.Settings.UserAgent = PoeTradeHandler.UserAgent; + WebView.CoreWebView2.CookieManager.DeleteAllCookies(); // Handle cookie changes by checking cookies after navigation WebView.CoreWebView2.NavigationCompleted += CoreWebView2_NavigationCompleted; @@ -72,10 +74,13 @@ private async void CoreWebView2_NavigationCompleted(object? sender, CoreWebView2 { try { + logger.LogInformation("[CloudflareWindow] Checking for Cloudflare cookie at " + WebUtility.UrlDecode(WebView.Source?.ToString())); + var cookies = await WebView.CoreWebView2.CookieManager.GetCookiesAsync(uri.GetLeftPart(UriPartial.Authority)); var cfCookie = cookies.FirstOrDefault(c => c.Name == "cf_clearance"); if (cfCookie == null) { + logger.LogInformation("[CloudflareWindow] Cookie not found"); return; }