Compare commits

..
2 changed files with 16 additions and 8 deletions
+5 -3
View File
@@ -1,4 +1,6 @@
## What's new in beta.29 ## What's new in beta.30
- Fix: org ID is now correctly read from b.account.memberships[0].organization.uuid — bootstrap nests memberships inside account, not at the root - Fix: removed WebView2 from periodic refresh — it was spawning a full Chromium process every 2 minutes and not cleaning up, causing ~1.5GB memory growth
- This was preventing usage limits from loading for all accounts - Fix: added Origin, Referer, sec-fetch-* and sec-ch-ua headers to HttpClient so the API accepts requests as browser fetches
- Periodic refresh now uses HttpClient only, falling back to data cached at login time
- To get limits showing: sign out and sign back in once so SaveAndClose can fetch usage with the corrected org ID path
+11 -5
View File
@@ -95,15 +95,13 @@ public class UsageViewModel : INotifyPropertyChanged
return; return;
} }
// Try HttpClient first (fast path) — may be rejected by server CORS/header checks // HttpClient refresh — WebView2 is NOT used here to avoid spawning a heavy
// browser process every refresh cycle (causes memory accumulation).
// SaveAndClose at login time is responsible for fetching live data via WebView2.
var (limits, overage, prepaid, email, orgId, ok) = hasCookies var (limits, overage, prepaid, email, orgId, ok) = hasCookies
? await TryHttpRefreshAsync(cookies) ? await TryHttpRefreshAsync(cookies)
: ([], null, null, null, null, false); : ([], null, null, null, null, false);
// Fall back to WebView2 (uses the shared browser session, not HttpClient)
if (!ok)
(limits, email, orgId) = await TryWebView2RefreshAsync();
// Fill in any blanks from cached values saved at login time // Fill in any blanks from cached values saved at login time
if (string.IsNullOrEmpty(email)) email = AppSettings.Default.Email; if (string.IsNullOrEmpty(email)) email = AppSettings.Default.Email;
if (string.IsNullOrEmpty(orgId)) orgId = AppSettings.Default.OrgId; if (string.IsNullOrEmpty(orgId)) orgId = AppSettings.Default.OrgId;
@@ -324,6 +322,14 @@ public class UsageViewModel : INotifyPropertyChanged
http.DefaultRequestHeaders.Add("User-Agent", http.DefaultRequestHeaders.Add("User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
"(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"); "(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36");
http.DefaultRequestHeaders.Add("Origin", "https://claude.ai");
http.DefaultRequestHeaders.Add("Referer", "https://claude.ai/");
http.DefaultRequestHeaders.Add("sec-fetch-dest", "empty");
http.DefaultRequestHeaders.Add("sec-fetch-mode", "cors");
http.DefaultRequestHeaders.Add("sec-fetch-site", "same-origin");
http.DefaultRequestHeaders.Add("sec-ch-ua", "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\"");
http.DefaultRequestHeaders.Add("sec-ch-ua-mobile", "?0");
http.DefaultRequestHeaders.Add("sec-ch-ua-platform", "\"Windows\"");
var cookieHeader = string.Join("; ", cookies.Select(c => $"{c.Name}={c.Value}")); var cookieHeader = string.Join("; ", cookies.Select(c => $"{c.Name}={c.Value}"));
http.DefaultRequestHeaders.Add("Cookie", cookieHeader); http.DefaultRequestHeaders.Add("Cookie", cookieHeader);
return http; return http;