Compare commits

..
3 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -99,8 +99,8 @@ public partial class LoginWindow : Window
return; return;
} }
const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json(); const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json();
const rawU=JSON.stringify(u).slice(0,300); const rawU=JSON.stringify(u).slice(0,400);
window.chrome.webview.postMessage({email:e,orgId:id,usage:u,debug:'src:'+orgSrc+'|ukeys:'+Object.keys(u||{}).join(',')+'|raw:'+rawB}); window.chrome.webview.postMessage({email:e,orgId:id,usage:u,debug:'src:'+orgSrc+'|ukeys:'+Object.keys(u||{}).join(',')+'|rawU:'+rawU+'|rawB:'+rawB});
}catch(ex){window.chrome.webview.postMessage({error:String(ex)});}})()"; }catch(ex){window.chrome.webview.postMessage({error:String(ex)});}})()";
await Browser.CoreWebView2.ExecuteScriptAsync(script); await Browser.CoreWebView2.ExecuteScriptAsync(script);
+3 -5
View File
@@ -1,6 +1,4 @@
## What's new in beta.30 ## What's new in beta.31
- 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 - Fix: placeholder cards now show after sign-in when no usage data is cached yet (main panel no longer goes blank)
- Fix: added Origin, Referer, sec-fetch-* and sec-ch-ua headers to HttpClient so the API accepts requests as browser fetches - Debug: raw usage API response now included in debug banner so we can see what the endpoint returns
- 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
+7 -4
View File
@@ -267,9 +267,10 @@ public class UsageViewModel : INotifyPropertyChanged
await Application.Current.Dispatcher.InvokeAsync(() => await Application.Current.Dispatcher.InvokeAsync(() =>
{ {
if (!string.IsNullOrEmpty(email)) UserEmail = email; if (!string.IsNullOrEmpty(email)) UserEmail = email;
if (limits.Count > 0) Limits = limits; // Always show cards — real data if available, placeholders if not
Limits = limits.Count > 0 ? limits : LoadPlaceholderLimits();
IsSignedIn = true; IsSignedIn = true;
ErrorMessage = limits.Count == 0 ? "Signed in — refreshing data…" : null; ErrorMessage = null;
LastUpdated = limits.Count > 0 ? DateTime.Now : LastUpdated; LastUpdated = limits.Count > 0 ? DateTime.Now : LastUpdated;
}); });
} }
@@ -470,16 +471,18 @@ public class UsageViewModel : INotifyPropertyChanged
return $"{diff.Hours}h {diff.Minutes}m"; return $"{diff.Hours}h {diff.Minutes}m";
} }
private void LoadPlaceholders() private static List<AgentLimit> LoadPlaceholderLimits()
{ {
var now = DateTime.Now; var now = DateTime.Now;
Limits = return
[ [
new() { Window = WindowKind.FiveHour, UsedPercent = 0, TimeRemaining = "—", ResetDate = now.AddHours(1) }, new() { Window = WindowKind.FiveHour, UsedPercent = 0, TimeRemaining = "—", ResetDate = now.AddHours(1) },
new() { Window = WindowKind.SevenDay, UsedPercent = 0, TimeRemaining = "—", ResetDate = now.AddDays(7) }, new() { Window = WindowKind.SevenDay, UsedPercent = 0, TimeRemaining = "—", ResetDate = now.AddDays(7) },
]; ];
} }
private void LoadPlaceholders() => Limits = LoadPlaceholderLimits();
private void LoadBurnHistory() private void LoadBurnHistory()
{ {
try try