Compare commits

...
3 changed files with 22 additions and 10 deletions
+3 -2
View File
@@ -83,8 +83,9 @@ public partial class LoginWindow : Window
const h={headers:{accept:'application/json'}}; const h={headers:{accept:'application/json'}};
const b=await(await fetch('/api/bootstrap',h)).json(); const b=await(await fetch('/api/bootstrap',h)).json();
const rawB=JSON.stringify(b).slice(0,600); const rawB=JSON.stringify(b).slice(0,600);
let id=b?.memberships?.[0]?.organization?.uuid||b?.organizations?.[0]?.uuid let id=b?.account?.memberships?.[0]?.organization?.uuid
||b?.default_organization?.uuid||b?.account?.uuid||null; ||b?.memberships?.[0]?.organization?.uuid||b?.organizations?.[0]?.uuid
||b?.default_organization?.uuid||null;
const e=b?.account?.email_address||b?.account?.email||b?.email||null; const e=b?.account?.email_address||b?.account?.email||b?.email||null;
let orgSrc='bootstrap'; let orgSrc='bootstrap';
if(!id){ if(!id){
+3 -4
View File
@@ -1,5 +1,4 @@
## What's new in beta.28 ## What's new in beta.29
- Debug banner now appears on the main panel after sign-in showing raw bootstrap data — paste this here so we can fix org ID parsing - Fix: org ID is now correctly read from b.account.memberships[0].organization.uuid — bootstrap nests memberships inside account, not at the root
- Fix: limits no longer wiped when a refresh cycle returns no data (placeholders stay until real data arrives) - This was preventing usage limits from loading for all accounts
- Try account.uuid as org ID fallback when no org found in bootstrap
+16 -4
View File
@@ -189,7 +189,8 @@ public class UsageViewModel : INotifyPropertyChanged
const string script = @"(async()=>{try{ const string script = @"(async()=>{try{
const h={headers:{accept:'application/json'}}; const h={headers:{accept:'application/json'}};
const b=await(await fetch('/api/bootstrap',h)).json(); const b=await(await fetch('/api/bootstrap',h)).json();
let id=b?.memberships?.[0]?.organization?.uuid||b?.organizations?.[0]?.uuid let id=b?.account?.memberships?.[0]?.organization?.uuid
||b?.memberships?.[0]?.organization?.uuid||b?.organizations?.[0]?.uuid
||b?.default_organization?.uuid||null; ||b?.default_organization?.uuid||null;
const em=b?.account?.email_address||b?.account?.email||b?.email||null; const em=b?.account?.email_address||b?.account?.email||b?.email||null;
if(!id){ if(!id){
@@ -355,8 +356,9 @@ public class UsageViewModel : INotifyPropertyChanged
acct.TryGetProperty("email_address", out var em)) acct.TryGetProperty("email_address", out var em))
email = em.GetString(); email = em.GetString();
// Path 1: memberships[0].organization.uuid // Path 1: account.memberships[0].organization.uuid (Claude.ai personal/pro accounts)
if (root.TryGetProperty("memberships", out var mems) && mems.GetArrayLength() > 0) if (root.TryGetProperty("account", out var acctNode) &&
acctNode.TryGetProperty("memberships", out var mems) && mems.GetArrayLength() > 0)
{ {
var first = mems[0]; var first = mems[0];
if (first.TryGetProperty("organization", out var org) && if (first.TryGetProperty("organization", out var org) &&
@@ -364,7 +366,17 @@ public class UsageViewModel : INotifyPropertyChanged
orgId = uuid.GetString(); orgId = uuid.GetString();
} }
// Path 2: organizations[0].uuid (flat list on root) // Path 2: memberships[0].organization.uuid (root-level, older API shape)
if (string.IsNullOrEmpty(orgId) &&
root.TryGetProperty("memberships", out var rootMems) && rootMems.GetArrayLength() > 0)
{
var first = rootMems[0];
if (first.TryGetProperty("organization", out var org) &&
org.TryGetProperty("uuid", out var uuid))
orgId = uuid.GetString();
}
// Path 3: organizations[0].uuid (flat list on root)
if (string.IsNullOrEmpty(orgId) && if (string.IsNullOrEmpty(orgId) &&
root.TryGetProperty("organizations", out var orgs) && orgs.GetArrayLength() > 0) root.TryGetProperty("organizations", out var orgs) && orgs.GetArrayLength() > 0)
{ {