Open-source Xbox-inspired desktop launcher for Xodus on Linux
TypeScript
fix(accounts): align vault metadata bounds and clarify account roles
domsvobodaaf9f9898767d
diff --git a/assets/locales/en.json b/assets/locales/en.jsonindex 64aa7bc..4d5c606 100644--- a/assets/locales/en.json+++ b/assets/locales/en.json@@ -1,4 +1,7 @@{+ "auth.store_signed_out": "Store signed out",+ "auth.store_account": "Store account",+ "auth.change_player_account": "Change player account","auth.sign_out_active_help": "Signs out active Store and player accounts and removes device registration. Saved Store accounts remain available until forgotten.","auth.active_signed_out": "Active accounts signed out. Saved Store accounts are retained.","auth.sign_out_all": "Sign out all accounts",@@ -640,7 +643,7 @@"ui.saved_store_accounts_help_94be2d0": "Store and Game Pass accounts you signed in with stay saved. Each game starts with the account it was installed with.","ui.account_switched_6a2e91c": "Store account switched","ui.account_forgotten_c05d7e3": "Saved account forgotten",- "ui.player_account_help_1d6f365": "The account above owns the games and the subscription. Add a second account here to play, earn achievements and sync cloud saves under it.",+ "ui.player_account_help_1d6f365": "The Store account provides game licenses and subscriptions. The Xbox player account is used for playing, achievements and cloud saves.","ui.player_account_signed_in_ac36aa2": "Player account signed in","ui.player_account_signed_out_6752e8f": "Player account signed out","ui.sign_in_player_account_c15aa58": "Sign in player account",diff --git a/src/main/multi-account.test.ts b/src/main/multi-account.test.tsindex b799831..6561ce1 100644--- a/src/main/multi-account.test.ts+++ b/src/main/multi-account.test.ts@@ -105,3 +105,11 @@ it('requires readable active Store status before Forget can mutate credentials',await expect(f.request('forget')).rejects.toThrow('Refresh account status');expect(f.context.forgetSavedAccount).not.toHaveBeenCalled();expect(f.context.authJob).toBeUndefined();});++it('accepts the full backend vault bounds without hiding valid saved accounts', () => {+ const long='a'.repeat(499)+'@example.test';+ expect(long).toHaveLength(512);+ const accounts=[long,...Array.from({length:63},(_,i)=>`store-${i}@example.test`)];+ expect(parseSavedAccounts(JSON.stringify({accounts,active:long}))).toEqual({accounts,active:long});+ expect(parseSavedAccounts(JSON.stringify({accounts:['x'.repeat(513)]}))).toEqual({accounts:[],active:undefined});+});diff --git a/src/main/saved-accounts.ts b/src/main/saved-accounts.tsindex 5f1ac04..4c733e5 100644--- a/src/main/saved-accounts.ts+++ b/src/main/saved-accounts.ts@@ -4,7 +4,7 @@ import { spawnTracked } from './process.js';export interface SavedAccounts { accounts: string[]; active?: string }export const validAccountName = (name: unknown): name is string =>- typeof name === 'string' && Boolean(name.trim()) && name.length <= 128 && !/[\x00-\x1f\x7f]/.test(name);+ typeof name === 'string' && Boolean(name.trim()) && name.length <= 512 && !/[\x00-\x1f\x7f]/.test(name);async function run(binary: string, args: string[]): Promise<{ code: number | null; output: string }> {const tracked = spawnTracked(binary, ['saved-accounts', ...args], { maxOutput: 100_000, stdoutOnly: true, outputDrainMs: 250 });@@ -19,7 +19,7 @@ export function parseSavedAccounts(output: string): SavedAccounts | null {const line = output.split('\n').map(entry => entry.trim()).reverse().find(entry => entry.startsWith('{'));const value = JSON.parse(line ?? '') as { accounts?: unknown; active?: unknown };if (!Array.isArray(value.accounts)) return null;- return { accounts: [...new Set(value.accounts.filter(validAccountName))].slice(0, 50), active: validAccountName(value.active) ? value.active : undefined };+ return { accounts: [...new Set(value.accounts.filter(validAccountName))].slice(0, 64), active: validAccountName(value.active) ? value.active : undefined };} catch { return null; }}diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex 8afa3a3..eb380e5 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -114,7 +114,7 @@ export function Sidebar({ data, page, go, openGame, openProfile, notifications,function AccountMembership({ auth }: { auth: AppSnapshot['auth'] }) {const label = auth.stored === true ? subscriptionBadge(auth.subscription) : undefined;if (label) return <small className="account-membership" title={ui("ui.subscription_verified_a950738", { date: new Date(auth.subscription!.checkedAt).toLocaleString() })}>{label}</small>;- return auth.stored === true ? null : <small>{auth.stored === false ? ui("ui.not_signed_in_491fc91") : ui("ui.status_unavailable_7eb5af9")}</small>;+ return auth.stored === true ? null : <small>{auth.stored === false ? (auth.player ? ui("auth.store_signed_out") : ui("ui.not_signed_in_491fc91")) : ui("ui.status_unavailable_7eb5af9")}</small>;}function AccountAvatar({ auth, large = false, license = false }: { auth: AppSnapshot['auth']; large?: boolean; license?: boolean }) {@@ -1030,14 +1030,14 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value</section><section className="settings-card account-card">- <div className="settings-heading"><AccountAvatar auth={data.auth} large license={Boolean(data.auth.player)} /><div><span className="overline">{ui("ui.microsoft_account_90f90f6")}</span><h2>{(data.auth.player ? data.auth.username : data.auth.gamertag ?? data.auth.username) ?? (data.auth.stored === false ? ui("ui.not_signed_in_491fc91") : ui("ui.account_status_unavailable_3b97a47"))}</h2><p>{data.auth.stored === true ? ui("ui.credentials_stored_by_xodus_bca3867") : ui("ui.authentication_uses_the_original_xodus_webview_cf2dcb9")}</p></div><span className={`status-label ${data.auth.stored === true ? 'ready' : data.auth.stored === false ? 'off' : 'unknown'}`}><StatusDot tone={data.auth.stored === true ? 'green' : data.auth.stored === false ? 'red' : 'amber'} />{data.auth.stored === true ? ui("ui.stored_1afc73e") : data.auth.stored === false ? ui("ui.signed_out_db8436b") : ui("ui.unknown_2375999")}</span></div>+ <div className="settings-heading"><AccountAvatar auth={data.auth} large license={Boolean(data.auth.player)} /><div><span className="overline">{caps.playerAccount ? ui("auth.store_account") : ui("ui.microsoft_account_90f90f6")}</span><h2>{(data.auth.player ? data.auth.username : data.auth.gamertag ?? data.auth.username) ?? (data.auth.stored === false ? ui("ui.not_signed_in_491fc91") : ui("ui.account_status_unavailable_3b97a47"))}</h2><p>{data.auth.stored === true ? ui("ui.credentials_stored_by_xodus_bca3867") : ui("ui.authentication_uses_the_original_xodus_webview_cf2dcb9")}</p></div><span className={`status-label ${data.auth.stored === true ? 'ready' : data.auth.stored === false ? 'off' : 'unknown'}`}><StatusDot tone={data.auth.stored === true ? 'green' : data.auth.stored === false ? 'red' : 'amber'} />{data.auth.stored === true ? ui("ui.stored_1afc73e") : data.auth.stored === false ? ui("ui.signed_out_db8436b") : ui("ui.unknown_2375999")}</span></div><div className="account-note"><CircleAlert /><span>{uiText(data.auth.note)}</span></div><KeyringSetup compact disabled={data.auth.running} /><div className="button-row"><button className="primary" disabled={!caps.login || data.auth.running} onClick={() => invoke('login', () => window.launcher.login(), ui("ui.xodus_sign_in_completed_8240737"))}>{data.auth.running ? <LoaderCircle className="spin" /> : <LogIn />}{data.auth.stored ? ui("ui.sign_in_again_51fbe1d") : ui("ui.sign_in_with_xodus_252572f")}</button><button className="secondary" disabled={!caps.logout || data.auth.running || (data.auth.stored === false && !data.auth.player)} title={caps.savedAccounts ? ui("auth.sign_out_active_help") : ui("ui.remove_saved_sign_in_credentials_and_local_devic_6485324")} onClick={() => invoke('logout', () => window.launcher.logout(), caps.savedAccounts ? ui("auth.active_signed_out") : ui("ui.saved_sign_in_credentials_and_local_device_regis_c9738bd"))}>{data.auth.player ? ui("auth.sign_out_all") : ui("ui.sign_out_48f0d3d")}</button><button className="secondary" disabled={!caps.account || data.auth.running} onClick={() => invoke('account', () => window.launcher.refreshAccount())}><RefreshCw />{ui("ui.refresh_status_442c4b8")}</button></div>{(data.auth.saved?.length ?? 0) > 0 && caps.savedAccounts ? <div className="saved-accounts" role="list" aria-label={ui("ui.saved_store_accounts_a1c4e72")}><span className="overline">{ui("ui.saved_store_accounts_a1c4e72")}</span>{data.auth.saved!.map(name => <div key={name} className="button-row" role="listitem">- <strong>{name}</strong>+ <strong title={name}>{name}</strong>{name === data.auth.username ? <span className="status-label ready">{ui("ui.account_in_use_5b09d3f")}</span>: <button className="secondary" disabled={data.auth.running} onClick={() => invoke('use-account', () => window.launcher.useAccount(name), ui("ui.account_switched_6a2e91c"))}>{ui("ui.use_this_account_e71c0a8")}</button>}<button className="secondary" disabled={data.auth.running || data.auth.stored === null} onClick={() => invoke('forget-account', () => window.launcher.forgetAccount(name), ui("ui.account_forgotten_c05d7e3"))}>{ui("ui.forget_account_3d8f6b1")}</button>@@ -1050,7 +1050,7 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value{caps.playerAccount && (data.auth.stored === true || data.auth.player) ? <section className="settings-card account-card"><div className="settings-heading">{data.auth.player ? <AccountAvatar auth={data.auth} large /> : null}<div><span className="overline">{ui("ui.xbox_player_account_021c236")}</span><h2>{data.auth.player ? (data.auth.gamertag ? `${data.auth.gamertag} · ${data.auth.player}` : data.auth.player) : ui("ui.no_separate_player_account_44980b5")}</h2><p>{ui("ui.player_account_help_1d6f365")}</p></div></div><div className="button-row">- <button className="primary" disabled={data.auth.running} onClick={() => invoke('login-player', () => window.launcher.login(true), ui("ui.player_account_signed_in_ac36aa2"))}>{ui("ui.sign_in_player_account_c15aa58")}</button>+ <button className="primary" disabled={data.auth.running} onClick={() => invoke('login-player', () => window.launcher.login(true), ui("ui.player_account_signed_in_ac36aa2"))}>{data.auth.player ? ui("auth.change_player_account") : ui("ui.sign_in_player_account_c15aa58")}</button>{data.auth.player ? <button className="secondary" disabled={data.auth.running} onClick={() => invoke('logout-player', () => window.launcher.logout(true), ui("ui.player_account_signed_out_6752e8f"))}>{ui("ui.sign_out_player_account_013bd34")}</button> : null}</div></section> : null}diff --git a/src/renderer/controls.css b/src/renderer/controls.cssindex d650209..73036cb 100644--- a/src/renderer/controls.css+++ b/src/renderer/controls.css@@ -188,3 +188,7 @@ html[data-gamepad-navigation] .toast { bottom: 144px; }.game-dialog:has(.game-launch-tools) { width: min(640px, 100%); }label.check-field:not(.check-switch):has(.check-copy small) { align-items: flex-start; }label.check-field:not(.check-switch):has(.check-copy small) input { margin-top: 2px; }++/* Keep complete saved identities in DOM/tooltips while fitting narrow account cards. */+.saved-accounts .button-row > strong { flex: 1 1 160px; min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }+.account-card .settings-heading h2 { overflow-wrap: anywhere; }diff --git a/src/renderer/multi-account.test.tsx b/src/renderer/multi-account.test.tsxindex 6b42f38..10f106b 100644--- a/src/renderer/multi-account.test.tsx+++ b/src/renderer/multi-account.test.tsx@@ -3,7 +3,7 @@ import { act } from 'react';import { createRoot } from 'react-dom/client';import { renderToStaticMarkup } from 'react-dom/server';import { expect, it, vi } from 'vitest';-import { SettingsPage } from './App';+import { SettingsPage, Sidebar } from './App';import { useNotifications } from './Notifications';import { demoSnapshot } from '../shared/demo-data';import { messageNoticeKey } from './notification-state';@@ -18,6 +18,7 @@ it('shows player credentials independently after Store sign-out and explains fulexpect(html).toContain('Sign out all accounts');expect(html).toContain('Saved Store accounts remain available until forgotten.');expect(html).toContain('[email protected]');+ expect(renderToStaticMarkup(<Sidebar data={data} page="settings" go={()=>{}} />)).toContain('Store signed out');});it('keeps notification reads and broker acknowledgements scoped to the effective Xbox player', async () => {