Skip to content

Open-source Xbox-inspired desktop launcher for Xodus on Linux

TypeScript

feat(home): show recent installations and official PC Game Pass additions

Nexus Maintainera40c05f5d3a7
diff --git a/assets/locales/en.json b/assets/locales/en.json
index 40d29fc..1e37d49 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -622,6 +622,7 @@
"ui.nexus_runtime_was_verified_installed_and_selecte_51b0ff1": "Nexus runtime was verified, installed, and selected.",
"ui.no_achievements_match_this_filter_311c982": "No achievements match this filter.",
"ui.no_backend_selected_e322189": "No backend selected",
+ "ui.no_completed_installations_yet_c0d583a": "No completed installations yet.",
"ui.no_download_required_56d8478": "No download required",
"ui.no_friends_returned_by_xbox_decddb3": "No friends returned by Xbox.",
"ui.no_game_logs_17cede8": "No game logs",
@@ -630,6 +631,7 @@
"ui.no_games_match_these_filters_e0e0d54": "No games match these filters.",
"ui.no_games_match_these_filters_in_the_loaded_resul_10d7834": "No games match these filters in the loaded results. Load more to continue.",
"ui.no_messages_returned_by_xbox_5a80816": "No messages returned by Xbox.",
+ "ui.no_new_pc_game_pass_games_are_available_right_now_08d8175": "No new PC Game Pass games are available right now.",
"ui.no_related_add_ons_were_found_for_this_game_37fb940": "No related add-ons were found for this game.",
"ui.no_runtime_selected_b8e7445": "No runtime selected",
"ui.no_screenshots_available_284d07a": "No screenshots available.",
@@ -714,7 +716,9 @@
"ui.ready_to_install_bda18b9": "Ready to install",
"ui.recent_achievements_5e17b64": "Recent achievements",
"ui.recently_added_96ec5d3": "Recently added",
+ "ui.recently_added_in_game_pass_07849d1": "Recently added in Game Pass",
"ui.recently_added_to_game_pass_0c69d8c": "Recently added to Game Pass",
+ "ui.recently_installed_d12be06": "Recently installed",
"ui.refresh_0e91610": "Refresh",
"ui.refresh_library_c628c56": "Refresh library",
"ui.refresh_status_442c4b8": "Refresh status",
@@ -780,6 +784,7 @@
"ui.show_less_94ea9b1": "Show less",
"ui.show_log_34b6683": "Show log",
"ui.show_log_file_5ea7142": "Show log file",
+ "ui.showing_the_last_loaded_pc_game_pass_list_try_agai_4344aca": "Showing the last loaded PC Game Pass list. Try again to refresh.",
"ui.showing_the_latest_100_messages_older_messages_a_7fb43bf": "Showing the latest 100 messages. Older messages are not loaded.",
"ui.sign_in_again_51fbe1d": "Sign in again",
"ui.sign_in_bfd402b": "Sign in",
@@ -826,6 +831,7 @@
"ui.the_log_file_is_no_longer_available_e454fa3": "The log file is no longer available.",
"ui.the_log_is_empty_7261125": "The log is empty.",
"ui.the_nexus_backend_was_verified_installed_and_act_62d374e": "The Nexus backend was verified, installed and activated.",
+ "ui.the_pc_game_pass_catalog_could_not_be_loaded_check_9d5d552": "The PC Game Pass catalog could not be loaded. Check your connection and try again.",
"ui.this_backend_does_not_support_xbox_friends_and_c_6ed1034": "This backend does not support Xbox friends and chat. Use a compatible Nexus backend.",
"ui.this_content_download_has_no_parent_game_3f408bd": "This content download has no parent game.",
"ui.this_download_has_already_ended_a8cdae1": "This download has already ended.",
@@ -835,6 +841,7 @@
"ui.top_paid_games_8040f77": "Top paid and trending games",
"ui.trending_pc_games_2025848": "Trending PC games",
"ui.try_a_different_title_or_a_microsoft_store_produ_326af8c": "Try a different title or a Microsoft Store Product ID.",
+ "ui.try_again_d8b839": "Try again",
"ui.try_this_if_a_standard_dualsense_controller_is_n_114e408": "Use if a DualSense is not detected. Disables native HIDRAW for this game only. Advanced haptics and adaptive triggers may be unavailable. Does not change Xbox controller settings.",
"ui.unavailable_ca18449": "Unavailable",
"ui.unknown_2375999": "UNKNOWN",
diff --git a/src/main/catalog.test.ts b/src/main/catalog.test.ts
index ee08447..565b689 100644
--- a/src/main/catalog.test.ts
+++ b/src/main/catalog.test.ts
@@ -394,3 +394,48 @@ describe('Store-only offer policy',()=>{
expect(await service.licensedProducts([id],'US')).toHaveLength(1);
});
});
+
+describe('public collection metadata',()=>{
+ const offers=(price=29.99)=>({Sku:{SkuType:'full',Properties:{Packages:[{PackageFormat:'MSIXVC',PlatformDependencies:[{PlatformName:'Windows.Desktop'}]}]}},Availabilities:[{OrderManagementData:{Price:{MSRP:price,ListPrice:price}}}]});
+ const freeOffer={Sku:{SkuType:'full',Properties:{}},Availabilities:[{OrderManagementData:{Price:{MSRP:0,ListPrice:0}}}]};
+ const detail=(productId:string,title:string,offersValue:unknown[],type='Game')=>({ProductId:productId,ProductType:type,
+ LocalizedProperties:[{ProductTitle:title,PublisherName:'Studio'}],DisplaySkuAvailabilities:offersValue});
+ it('keeps the requested official order and applies public Store eligibility',async()=>{
+ const ids=['9AAAAAA00001','9BBBBBB00002','9CCCCCC00003','9DDDDDD00004'];
+ const products=[detail(ids[2],'Third',[offers()]),detail(ids[0],'First',[offers()]),
+ detail(ids[1],'Free',[freeOffer]),detail(ids[3],'Add-on',[offers()],'Durable')];
+ const fetcher=async(input:unknown)=>{
+ const url=new URL(String(input));
+ expect(url.pathname).toBe('/v7.0/products');
+ expect(url.searchParams.get('market')).toBe('US');
+ expect(url.searchParams.get('bigIds')).toBe(ids.join(','));
+ return new Response(JSON.stringify({Products:products}),{status:200});
+ };
+ const result=await new CatalogService(fetcher as typeof fetch).publicProducts(ids,'US');
+ expect(result.map(product=>product.productId)).toEqual([ids[0],ids[2]]);
+ expect(result.every(product=>!('access' in product))).toBe(true);
+ });
+ it('batches large metadata windows without losing the requested order',async()=>{
+ const ids=Array.from({length:30},(_,index)=>`9${String(index+1).padStart(11,'0')}`);
+ const batches:string[][]=[];
+ const fetcher=async(input:unknown)=>{
+ const url=new URL(String(input)),batch=(url.searchParams.get('bigIds')??'').split(',');
+ batches.push(batch);
+ return new Response(JSON.stringify({Products:[...batch].reverse().map(value=>detail(value,`Title ${value}`,[offers()]))}),{status:200});
+ };
+ const result=await new CatalogService(fetcher as typeof fetch).publicProducts(ids,'US');
+ expect(batches.map(batch=>batch.length)).toEqual([25,5]);
+ expect(result.map(product=>product.productId)).toEqual(ids);
+ });
+ it('fails the shelf when display metadata is unavailable instead of reporting an empty collection',async()=>{
+ const fetcher=async()=>new Response('{}',{status:503});
+ await expect(new CatalogService(fetcher as typeof fetch).publicProducts(['9AAAAAA00001'],'US')).rejects.toThrow('public Store metadata');
+ });
+ it('skips rows without a real localized title and rejects malformed or unbounded lists',async()=>{
+ const fetcher=async()=>new Response(JSON.stringify({Products:[detail('9AAAAAA00001','',[]),detail('9BBBBBB00002','Visible',[offers()])]}),{status:200});
+ const service=new CatalogService(fetcher as typeof fetch);
+ expect((await service.publicProducts(['9AAAAAA00001','9BBBBBB00002'],'US')).map(product=>product.title)).toEqual(['Visible']);
+ for(const value of [[],['9aaaaaa00001'],Array.from({length:61},(_,index)=>`9${String(index).padStart(11,'0')}`)])
+ await expect(service.publicProducts(value,'US')).rejects.toThrow('public product list');
+ });
+});
diff --git a/src/main/catalog.ts b/src/main/catalog.ts
index afa26b6..bdecdbc 100644
--- a/src/main/catalog.ts
+++ b/src/main/catalog.ts
@@ -221,6 +221,22 @@ function mergeCollections(...collections: StoreSearchResponse[]): StoreSearchRes
return { productsList };
}
+/** Build the search-shaped row that both the licensed and public catalog
+ * paths feed into the shared parser. It only reuses display metadata that the
+ * detail response already returned; absence is never replaced by a guess. */
+function localizedRow(product: Record<string, unknown>): StoreSearchProduct | undefined {
+ const productId = string(product.ProductId)?.toUpperCase();
+ if (!productId) return;
+ const localized = Array.isArray(product.LocalizedProperties) ? object(product.LocalizedProperties[0]) : undefined;
+ const images = Array.isArray(localized?.Images) ? localized.Images as DisplayCatalogImage[] : [];
+ const find = (purposes: string[]) => {
+ const uri = string(purposes.flatMap(purpose => images.filter(image => image.ImagePurpose === purpose))[0]?.Uri);
+ return uri?.startsWith('//') ? `https:${uri}` : uri;
+ };
+ return { productId, title: string(localized?.ProductTitle) ?? productId, description: localized?.ProductDescription,
+ publisherName: localized?.PublisherName, boxArtUrl: find(POSTER_PURPOSES), isGame: true };
+}
+
function packageSupport(productId: string, details: Map<string, Record<string, unknown>>, visited = new Set<string>(), budget = { remaining: 512 }): PackageSupport {
if (visited.size > 6 || budget.remaining-- <= 0) return {
installability: 'unknown', supportNote: 'The Store bundle metadata could not be fully resolved.',
@@ -420,20 +436,40 @@ export class CatalogService {
const product = object(entry);
const id = string(product?.ProductId);
if (!product || !id || !wanted.has(id) || product.ProductType !== 'Game') return [];
- const localized = Array.isArray(product.LocalizedProperties) ? object(product.LocalizedProperties[0]) : undefined;
- const images = Array.isArray(localized?.Images) ? localized.Images as DisplayCatalogImage[] : [];
- const find = (purposes: string[]) => {
- const uri = string(purposes.flatMap(purpose => images.filter(image => image.ImagePurpose === purpose))[0]?.Uri);
- return uri?.startsWith('//') ? `https:${uri}` : uri;
- };
- return [{ productId: id, title: string(localized?.ProductTitle) ?? id, description: localized?.ProductDescription,
- publisherName: localized?.PublisherName, boxArtUrl: find(POSTER_PURPOSES), isGame: true }];
+ const row = localizedRow(product);
+ return row ? [row] : [];
});
// Ownership and installation support are independent. Preserve the game's
// real package status for the library badge and Ready to install filter.
return parseCatalogProducts({ productsList: rows }, catalog);
}
+ /** Read public descriptive metadata for an official collection in the given
+ * order. Public browsing eligibility hides demos, trials and positively free
+ * offers; the result never implies ownership or permission to install. */
+ async publicProducts(ids: string[], rawMarket: string): Promise<CatalogProduct[]> {
+ if (!ids.length || ids.length > 60 || ids.some(id => !/^[A-Z0-9]{12}$/.test(id))) throw Error('Invalid public product list.');
+ const unique = [...new Set(ids)];
+ const catalog = await this.details(unique, normalizeMarket(rawMarket));
+ // `details` tolerates one failed enrichment batch for search cards. A shelf
+ // with no display metadata at all is an honest load failure, not an empty
+ // collection or a reason to present guessed games.
+ if (!Array.isArray(catalog.Products) || catalog.Products.length === 0)
+ throw Error('The public Store metadata could not be loaded. Check your connection and retry.');
+ const details = new Map<string, Record<string, unknown>>();
+ for (const entry of Array.isArray(catalog.Products) ? catalog.Products : []) {
+ const product = object(entry), productId = string(product?.ProductId)?.toUpperCase();
+ if (product && productId) details.set(productId, product);
+ }
+ const rows = unique.flatMap(id => {
+ const product = details.get(id);
+ const row = product ? localizedRow(product) : undefined;
+ // A display row without its real localized title is not a usable card.
+ return row && row.title !== id ? [row] : [];
+ });
+ return parseCatalogProducts({ productsList: rows }, catalog, 'store');
+ }
+
private async fetchDetails(batch: string[], market: string): Promise<Record<string, unknown>[]> {
const url = new URL('https://displaycatalog.mp.microsoft.com/v7.0/products');
url.searchParams.set('bigIds', batch.join(','));
diff --git a/src/main/home-gamepass.test.ts b/src/main/home-gamepass.test.ts
new file mode 100644
index 0000000..dcf420d
--- /dev/null
+++ b/src/main/home-gamepass.test.ts
@@ -0,0 +1,124 @@
+import {expect,it,vi} from 'vitest';
+import {CatalogService} from './catalog.js';
+import {RecentPcGamePass} from './gamepass-recent.js';
+import {HOME_GAMEPASS_FETCH,HOME_GAMEPASS_LIMIT,HomeGamePassShelf} from './home-gamepass.js';
+import type {RecentGamePassShelf} from '../shared/types.js';
+
+const COLLECTION='06323672-b8c8-43cc-b0de-32d5a9834749';
+const metadata={siglId:COLLECTION,requiresShuffling:'False',title:'Recently added'};
+const id=(index:number)=>`9${String(index).padStart(11,'0')}`;
+const ids=Array.from({length:4},(_,index)=>id(index+1));
+const paidSku=(price=29.99)=>({Sku:{SkuType:'full',Properties:{Packages:[{PackageFormat:'MSIXVC',PlatformDependencies:[{PlatformName:'Windows.Desktop'}]}]}},Availabilities:[{OrderManagementData:{Price:{MSRP:price,ListPrice:price}}}]});
+const freeSku=()=>({Sku:{SkuType:'full',Properties:{}},Availabilities:[{OrderManagementData:{Price:{MSRP:0,ListPrice:0}}}]});
+const product=(productId:string,title:string,skus:unknown[]=[paidSku()],type='Game')=>({ProductId:productId,ProductType:type,
+ LocalizedProperties:[{ProductTitle:title,PublisherName:'Studio'}],DisplaySkuAvailabilities:skus});
+
+function fixture(overrides:Record<string,unknown>={}){
+ const requests:string[]=[];
+ const fetcher=vi.fn(async(input:URL|RequestInfo)=>{
+ const url=new URL(String(input));requests.push(url.toString());
+ if(`${url.origin}${url.pathname}`==='https://catalog.gamepass.com/sigls/v3'){
+ expect(Object.fromEntries(url.searchParams)).toEqual({id:COLLECTION,language:'en-US',market:'US',platformContext:'pc',subscriptionContext:'cfq7ttc0kgq8'});
+ return new Response(JSON.stringify([metadata,...ids.map(value=>({id:value}))]));
+ }
+ if(url.pathname.endsWith('/v7.0/products')){
+ expect(url.searchParams.get('market')).toBe('US');
+ expect(url.searchParams.get('languages')).toBe('en-us,neutral');
+ const batch=(url.searchParams.get('bigIds')??'').split(',');
+ // Shuffle the detail response so the shelf must keep the official order.
+ return new Response(JSON.stringify({Products:[...batch].reverse().map((value,index)=>product(value,`Game ${index}`,overrides[value] as unknown[]??[paidSku()]))}));
+ }
+ throw Error(`Unexpected request ${url}`);
+ }) as unknown as typeof fetch;
+ return {fetcher,requests};
+}
+
+it('loads the official public PC recent collection and keeps its order, scope and bounded metadata',async()=>{
+ const {fetcher,requests}=fixture();
+ const now=()=>0;
+ const shelf=await new HomeGamePassShelf(new RecentPcGamePass(fetcher,now),new CatalogService(fetcher),now).get('US');
+ expect(shelf).toMatchObject({market:'US',source:'Microsoft Game Pass catalog'});
+ expect(shelf.stale).toBeUndefined();
+ expect(shelf.products.map(product=>product.productId)).toEqual(ids);
+ expect(shelf.products.every(product=>!('access' in product))).toBe(true);
+ expect(requests.filter(value=>value.includes('/sigls/v3'))).toHaveLength(1);
+ const details=requests.filter(value=>value.includes('/v7.0/products'));
+ expect(details).toHaveLength(1);
+ expect(new URL(details[0]).searchParams.get('bigIds')).toBe(ids.join(','));
+});
+
+it('bounds the metadata window while retaining the first official order',async()=>{
+ const long=Array.from({length:24},(_,index)=>id(index+1));
+ const fetcher=vi.fn(async(input:URL|RequestInfo)=>{
+ const url=new URL(String(input));
+ if(url.pathname.includes('/sigls/v3'))return new Response(JSON.stringify([metadata,...long.map(value=>({id:value}))]));
+ const batch=(url.searchParams.get('bigIds')??'').split(',');
+ expect(batch).toHaveLength(HOME_GAMEPASS_FETCH);
+ return new Response(JSON.stringify({Products:batch.reverse().map(value=>product(value,`Title ${value}`))}));
+ }) as unknown as typeof fetch;
+ const shelf=await new HomeGamePassShelf(new RecentPcGamePass(fetcher),new CatalogService(fetcher)).get('US');
+ expect(shelf.products.map(product=>product.productId)).toEqual(long.slice(0,HOME_GAMEPASS_LIMIT));
+});
+
+it('applies the public Store policy instead of assuming every recent game is usable or owned',async()=>{
+ const all=[id(1),id(2),id(3),id(4)];
+ const overrides={
+ [id(1)]:[paidSku()],
+ [id(2)]:[freeSku()],
+ [id(3)]:[{...paidSku(),Sku:{SkuType:'full',Properties:{IsTrial:true}},Availabilities:[{OrderManagementData:{Price:{MSRP:29.99,ListPrice:29.99}}}]}],
+ [id(4)]:[],
+ };
+ const fetcher=vi.fn(async(input:URL|RequestInfo)=>{
+ const url=new URL(String(input));
+ if(url.pathname.includes('/sigls/v3'))return new Response(JSON.stringify([metadata,...all.map(value=>({id:value}))]));
+ const batch=(url.searchParams.get('bigIds')??'').split(',');
+ return new Response(JSON.stringify({Products:batch.map(value=>value===id(4)?product(value,'Add-on',[],'Durable'):product(value,`Title ${value}`,overrides[value as keyof typeof overrides]))}));
+ }) as unknown as typeof fetch;
+ const shelf=await new HomeGamePassShelf(new RecentPcGamePass(fetcher),new CatalogService(fetcher)).get('US');
+ expect(shelf.products.map(product=>product.productId)).toEqual([id(1)]);
+});
+
+it('reports a real empty shelf when the official collection has no games',async()=>{
+ const fetcher=vi.fn(async(input:URL|RequestInfo)=>{
+ const url=new URL(String(input));
+ if(!url.pathname.includes('/sigls/v3'))throw Error('Metadata must not be requested for an empty collection.');
+ return new Response(JSON.stringify([metadata]));
+ }) as unknown as typeof fetch;
+ const shelf=await new HomeGamePassShelf(new RecentPcGamePass(fetcher),new CatalogService(fetcher)).get('US');
+ expect(shelf.products).toEqual([]);
+ expect(shelf.source).toBe('Microsoft Game Pass catalog');
+});
+
+it('coalesces concurrent loads, caches for ten minutes and serves explicitly stale real data on failure',async()=>{
+ let now=0,fail=false;
+ const {fetcher}=fixture();
+ const wrapped=vi.fn(async(input:URL|RequestInfo)=>{
+ if(fail)throw Error('PRIVATE_NETWORK_TOKEN');
+ return fetcher(input);
+ }) as unknown as typeof fetch;
+ const shelfService=new HomeGamePassShelf(new RecentPcGamePass(wrapped,()=>now),new CatalogService(wrapped),()=>now);
+ const [first,second]=await Promise.all([shelfService.get('US'),shelfService.get('US')]);
+ expect(first.products.map(product=>product.productId)).toEqual(ids);
+ expect(second.products).toEqual(first.products);
+ expect(wrapped).toHaveBeenCalledTimes(2); // one collection request and one details request
+ now=10*60_000;expect((await shelfService.get('US')).products).toHaveLength(ids.length);expect(wrapped).toHaveBeenCalledTimes(4);
+ now=20*60_000;fail=true;
+ const [stale,concurrentStale]=await Promise.all([shelfService.get('US'),shelfService.get('US')]);
+ expect(stale.stale).toBe(true);expect(concurrentStale.stale).toBe(true);
+ expect(stale.products.map(product=>product.productId)).toEqual(ids);
+ expect(concurrentStale.products).toEqual(stale.products);
+ await expect(shelfService.get('not a market')).rejects.toThrow('market');
+});
+
+it('fails honestly when neither a fresh nor a previous public list exists',async()=>{
+ const fetcher=vi.fn(async()=>{throw Error('PRIVATE_NETWORK_TOKEN')}) as unknown as typeof fetch;
+ const shelf=new HomeGamePassShelf(new RecentPcGamePass(fetcher),new CatalogService(fetcher));
+ await expect(shelf.get('US')).rejects.toThrow('recently added list');
+});
+
+it('does not turn a release date or a fetch time into an added timestamp',async()=>{
+ const response:RecentGamePassShelf=await new HomeGamePassShelf(
+ new RecentPcGamePass(fixture().fetcher),new CatalogService(fixture().fetcher)).get('US');
+ expect(Object.keys(response).sort()).toEqual(['fetchedAt','market','products','source']);
+ expect(response.products.every(product=>!('addedAt' in product))).toBe(true);
+});
diff --git a/src/main/home-gamepass.ts b/src/main/home-gamepass.ts
new file mode 100644
index 0000000..eda16d1
--- /dev/null
+++ b/src/main/home-gamepass.ts
@@ -0,0 +1,59 @@
+import type { RecentGamePassShelf } from '../shared/types.js';
+import type { CatalogService } from './catalog.js';
+import type { RecentPcGamePass } from './gamepass-recent.js';
+
+/** One bounded metadata window for the Home row. The official collection can
+ * be longer; a wider window leaves room for public-policy filtering while the
+ * presentation stays a short, bounded shelf. */
+export const HOME_GAMEPASS_FETCH = 24;
+export const HOME_GAMEPASS_LIMIT = 12;
+const TTL = 10 * 60_000;
+
+type Recent = Pick<RecentPcGamePass, 'get'>;
+type PublicCatalog = Pick<CatalogService, 'publicProducts'>;
+
+/**
+ * Public PC Game Pass shelf for Home.
+ *
+ * Membership and order come from the existing official anonymous PC
+ * collection. Display metadata is resolved through the same public Store
+ * policy as Store browsing, so demos, trials and free offers stay hidden.
+ * This is not an owned account Library and never grants install access.
+ */
+export class HomeGamePassShelf {
+ private readonly cache = new Map<string, { until: number; value: RecentGamePassShelf }>();
+ private readonly requests = new Map<string, Promise<RecentGamePassShelf>>();
+ constructor(private readonly recent: Recent, private readonly catalog: PublicCatalog, private readonly now = Date.now) {}
+
+ async get(market: string): Promise<RecentGamePassShelf> {
+ if (!/^[A-Z]{2}$/.test(market)) throw Error('Invalid public Store market.');
+ const cached = this.cache.get(market);
+ if (cached && cached.until > this.now()) return structuredClone(cached.value);
+ const pending = this.requests.get(market);
+ if (pending) return structuredClone(await pending);
+ const job = this.read(market).catch(error => {
+ // A previously loaded real list may be shown as explicitly stale, never
+ // as a fresh answer and never with invented products or timestamps.
+ if (cached) return { ...cached.value, stale: true } as RecentGamePassShelf;
+ throw error;
+ });
+ this.requests.set(market, job);
+ try {
+ const value = await job;
+ if (!value.stale) {
+ this.cache.set(market, { until: this.now() + TTL, value });
+ while (this.cache.size > 8) this.cache.delete(this.cache.keys().next().value!);
+ }
+ return structuredClone(value);
+ } finally {
+ this.requests.delete(market);
+ }
+ }
+
+ private async read(market: string): Promise<RecentGamePassShelf> {
+ const ids = await this.recent.get(market);
+ if (!ids.length) return { market, products: [], fetchedAt: new Date(this.now()).toISOString(), source: 'Microsoft Game Pass catalog' };
+ const products = await this.catalog.publicProducts(ids.slice(0, HOME_GAMEPASS_FETCH), market);
+ return { market, products: products.slice(0, HOME_GAMEPASS_LIMIT), fetchedAt: new Date(this.now()).toISOString(), source: 'Microsoft Game Pass catalog' };
+ }
+}
diff --git a/src/main/index.ts b/src/main/index.ts
index f964efc..7feb209 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -82,6 +82,8 @@ import { enableSavedAccounts, forgetSavedAccount, listSavedAccounts, useSavedAcc
import { AccountRefresh, readAccount } from './account-refresh.js';
import { AccountLibrary } from './account-library.js';
import { RecentPcGamePass } from './gamepass-recent.js';
+import { HomeGamePassShelf } from './home-gamepass.js';
+import { newInstallationTime } from './install-time.js';
import { GameActivities, installedTitleId } from './game-activity.js';
import {gameDetailsTarget} from './game-details-target.js';
import { GameAchievementsReader } from './game-achievements.js';
@@ -212,6 +214,7 @@ const catalog = new CatalogService();
const gameActivities = new GameActivities();
const gameAchievements = new GameAchievementsReader();
const recentPcGamePass = new RecentPcGamePass();
+const homeGamePassShelf = new HomeGamePassShelf(recentPcGamePass, catalog);
const accountLibrary = new AccountLibrary((ids, market) => catalog.licensedProducts(ids, market), undefined, market => recentPcGamePass.get(market));
/** The longest a launch waits for owned bundles (a library read takes about 2 s) before its DLC hints. */
const OWNED_ACCESS_WAIT_MS = 2_500;
@@ -1086,7 +1089,12 @@ async function runDownload(task: DownloadTask, binary: string, market: string, u
delete gameUpdates[updateGame.id];
}
}
- else await store.upsertGame({ ...inspected, licenseAccount: installAccount, offerProductId: /^[A-Z0-9]{12}$/.test(task.productId) ? task.productId : undefined });
+ else {
+ const installedAt = newInstallationTime(
+ store.games.find(entry => entry.id === inspected.id || entry.path === inspected.path),
+ task.status, inspected.installState, task.finishedAt);
+ await store.upsertGame({ ...inspected, ...(installedAt ? { installedAt } : {}), licenseAccount: installAccount, offerProductId: /^[A-Z0-9]{12}$/.test(task.productId) ? task.productId : undefined });
+ }
} catch (error) {
if (updateGame) await refreshIncompleteUpdate(updateGame).catch(() => {});
if (updateGame && task.status === 'complete') {
@@ -1779,6 +1787,7 @@ function registerDemoIpc(catalogMarket: () => string): void {
ipcMain.handle('set-offline-permissions', (_event, enabled: boolean) => ({ enabled: Boolean(enabled), requestSuccess: true, remainingToggles: 1, maxToggles: 3, periodDays: 365, checkedAt: new Date().toISOString() }));
ipcMain.handle('catalog-search', (_event, query: string, cursor?: string) => catalog.search(query, publicStoreMarket(), cursor));
ipcMain.handle('catalog-featured', () => catalog.featured(publicStoreMarket()));
+ ipcMain.handle('catalog-recent-gamepass', () => homeGamePassShelf.get(publicStoreMarket()));
ipcMain.handle('store-access', () => ({configuredMarket:snapshot().settings.market,account:snapshot().auth.username??'demo',backend:snapshot().backend.binaryPath??'',market:catalogMarket(),checkedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+60_000).toISOString(),accessByProductId:{}}));
ipcMain.handle('account-library', (_event, kind: 'all' | 'owned' | 'gamepass') => demoAccountLibrary(kind, demoArtwork));
ipcMain.handle('stop-game-update-check', () => {});
@@ -2080,6 +2089,7 @@ function registerIpc(): void {
});
ipcMain.handle('save-diagnostic-report', (_event, content: unknown) => saveReviewedReport(content));
ipcMain.handle('catalog-featured', () => catalog.featured(publicStoreMarket()));
+ ipcMain.handle('catalog-recent-gamepass', () => homeGamePassShelf.get(publicStoreMarket()));
ipcMain.handle('start-install', (_event, request: InstallRequest) => startInstall(request));
ipcMain.handle('install-plan', async (_event, raw: string, destination?: string) => {
const binary = requireBackend('streaming');
diff --git a/src/main/install-time.test.ts b/src/main/install-time.test.ts
new file mode 100644
index 0000000..e7f01ab
--- /dev/null
+++ b/src/main/install-time.test.ts
@@ -0,0 +1,39 @@
+import {mkdtemp,rm} from 'node:fs/promises';
+import {tmpdir} from 'node:os';
+import path from 'node:path';
+import {expect,it} from 'vitest';
+import type {Game} from '../shared/types.js';
+import {newInstallationTime} from './install-time.js';
+import {StateStore} from './store.js';
+
+const game=(patch:Partial<Game>={}):Game=>({id:'fixture',title:'Fixture',path:'/games/fixture',installState:'ready',addedAt:'2025-01-01T00:00:00.000Z',...patch});
+
+it('records completion only for a genuinely new successful installation',()=>{
+ expect(newInstallationTime(undefined,'complete','ready','2026-11-04T10:00:00.000Z')).toBe('2026-11-04T10:00:00.000Z');
+ expect(newInstallationTime(undefined,'complete','imported','2026-11-04T10:00:00.000Z')).toBeUndefined();
+ expect(newInstallationTime(undefined,'complete','incomplete','2026-11-04T10:00:00.000Z')).toBeUndefined();
+ expect(newInstallationTime(undefined,'failed','ready','2026-11-04T10:00:00.000Z')).toBeUndefined();
+ expect(newInstallationTime(undefined,'paused','ready','2026-11-04T10:00:00.000Z')).toBeUndefined();
+ expect(newInstallationTime(undefined,'complete','ready',undefined)).toBeUndefined();
+ expect(newInstallationTime(undefined,'complete','ready','not a date')).toBeUndefined();
+});
+
+it('never replaces an existing or unknown installation timestamp on repair, update or import',async()=>{
+ const existing=game({installedAt:'2026-10-01T09:00:00.000Z'});
+ expect(newInstallationTime(existing,'complete','ready','2026-11-04T10:00:00.000Z')).toBeUndefined();
+ const directory=await mkdtemp(path.join(tmpdir(),'nexus-install-time-'));
+ try{
+ const store=new StateStore(directory);await store.load();
+ await store.upsertGame(game());
+ const legacy=new StateStore(directory);await legacy.load();
+ expect(legacy.games[0].installedAt).toBeUndefined();
+ expect(legacy.games[0].addedAt).toBe('2025-01-01T00:00:00.000Z');
+ await legacy.patchGame('fixture',{installState:'ready'});
+ const reopened=new StateStore(directory);await reopened.load();
+ expect(reopened.games[0].installedAt).toBeUndefined();
+ expect(reopened.games[0].addedAt).toBe('2025-01-01T00:00:00.000Z');
+ await reopened.upsertGame(game({installedAt:'2026-11-04T10:00:00.000Z'}));
+ const installed=new StateStore(directory);await installed.load();
+ expect(installed.games[0].installedAt).toBe('2026-11-04T10:00:00.000Z');
+ }finally{await rm(directory,{recursive:true,force:true});}
+});
diff --git a/src/main/install-time.ts b/src/main/install-time.ts
new file mode 100644
index 0000000..7206a3f
--- /dev/null
+++ b/src/main/install-time.ts
@@ -0,0 +1,19 @@
+import type { DownloadTask, Game } from '../shared/types.js';
+
+/**
+ * Completion timestamp for a genuinely new successful installation only.
+ *
+ * Repairs and updates keep the existing value, imports never get one, and an
+ * incomplete result or an unknown legacy timestamp is left absent instead of
+ * being replaced by the inspection clock.
+ */
+export function newInstallationTime(
+ existing: Game | undefined,
+ status: DownloadTask['status'],
+ installState: Game['installState'],
+ finishedAt: string | undefined,
+): string | undefined {
+ if (existing || status !== 'complete' || installState !== 'ready' || !finishedAt) return;
+ if (!Number.isFinite(Date.parse(finishedAt))) return;
+ return finishedAt;
+}
diff --git a/src/main/public-store-ipc.test.ts b/src/main/public-store-ipc.test.ts
index 30a56af..f8715e4 100644
--- a/src/main/public-store-ipc.test.ts
+++ b/src/main/public-store-ipc.test.ts
@@ -29,29 +29,30 @@ function handlerStatements(names:string[],owner:string):string{
if(missing.length)throw Error(`Missing IPC handlers: ${missing.join(', ')}.`);
return found.map(node=>node.getText(parsed)).join('\n');
}
-const mainNames=['catalog-search','catalog-featured','game-details','store-access','account-library','install-plan','game-activity','game-achievements'];
+const mainNames=['catalog-search','catalog-featured','catalog-recent-gamepass','game-details','store-access','account-library','install-plan','game-activity','game-achievements'];
const mainCode=ts.transpileModule([declarations(['storeAccess']),handlerStatements(mainNames,'registerIpc')].join('\n'),{compilerOptions:{target:ts.ScriptTarget.ES2022}}).outputText;
-const demoCode=ts.transpileModule(handlerStatements(['catalog-search','catalog-featured','game-details','store-access'],'registerDemoIpc'),{compilerOptions:{target:ts.ScriptTarget.ES2022}}).outputText;
+const demoCode=ts.transpileModule(handlerStatements(['catalog-search','catalog-featured','catalog-recent-gamepass','game-details','store-access'],'registerDemoIpc'),{compilerOptions:{target:ts.ScriptTarget.ES2022}}).outputText;
function fixture(mode:'main'|'demo'){
const handlers=new Map<string,Function>(),products={query:'q',market:'US',products:[],hasMore:false,fetchedAt:'',source:'Microsoft Store'};
// CZ desktop with settings.market 'neutral': the effective account region.
let market='CZ';
const catalog={search:vi.fn(async()=>products),featured:vi.fn(async()=>products),gameDetails:vi.fn(async(productId:string)=>({productId,xboxTitleId:'123'}))};
+ const homeGamePassShelf={get:vi.fn(async(market:string)=>({market,products:[],fetchedAt:'2026-11-04T10:00:00.000Z',source:'Microsoft Game Pass catalog'}))};
const games=[{id:'owned-game',storeId:'9GGGGGGGGGGG',title:'Owned Game',path:'/synthetic/game'}];
const store={games,settings:{market:'neutral'}};
const accountLibrary={select:vi.fn(),get:vi.fn(async()=>({kind:'owned',products:[],accessByProductId:{}})),storeAccess:vi.fn(async(configuredMarket:string)=>({configuredMarket,account:'fixture',market,checkedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+60_000).toISOString(),accessByProductId:{},backend:'/fixture/cli'}))};
const installPlans={get:vi.fn(async()=>({choices:[]}))};
const gameActivities={select:vi.fn(),get:vi.fn(async()=>({status:'available'}))},gameAchievements={select:vi.fn(),get:vi.fn(async()=>({status:'available'}))};
const installedTitleId=vi.fn(async()=> '456');
- const context:any={ipcMain:{handle:(name:string,fn:Function)=>handlers.set(name,fn)},catalog,currentMarket:()=>market,publicStoreMarket,catalogDetailMarket,gameDetailsTarget,store,accountLibrary,installPlans,
+ const context:any={ipcMain:{handle:(name:string,fn:Function)=>handlers.set(name,fn)},catalog,homeGamePassShelf,currentMarket:()=>market,publicStoreMarket,catalogDetailMarket,gameDetailsTarget,store,accountLibrary,installPlans,
authState:{running:false,stored:true,username:'fixture',player:undefined},backend:{current:{binaryPath:'/fixture/cli',capabilities:{library:true,packageSelection:true,gameActivity:true,achievements:true}}},
requireBackend:()=>'/fixture/cli',safeProductId:(value:string)=>value,availableInstallBytes:async()=>1024,
gameActivities,gameAchievements,installedTitleId,
snapshot:()=>({settings:{market:'neutral'},auth:{username:'fixture'},backend:{binaryPath:'/fixture/cli'}}),
catalogMarket:()=>market,demoGames:games,demoArtwork:new Map(),demoAccountLibrary:vi.fn(),demoLocales:{},demoLaunchOptions:{}};
runInNewContext(mode==='main'?mainCode:demoCode,context);
- return {catalog,accountLibrary,installPlans,gameActivities,gameAchievements,setMarket:(value:string)=>market=value,call:(name:string,...args:unknown[])=>handlers.get(name)!(undefined,...args)};
+ return {catalog,homeGamePassShelf,accountLibrary,installPlans,gameActivities,gameAchievements,setMarket:(value:string)=>market=value,call:(name:string,...args:unknown[])=>handlers.get(name)!(undefined,...args)};
}
it('browses the neutral US Store on a CZ desktop while Store access keeps the effective region',async()=>{
@@ -60,6 +61,11 @@ it('browses the neutral US Store on a CZ desktop while Store access keeps the ef
expect(f.catalog.search).toHaveBeenCalledWith('gears','US','cursor');
await f.call('catalog-featured');
expect(f.catalog.featured).toHaveBeenCalledWith('US');
+ await f.call('catalog-recent-gamepass');
+ expect(f.homeGamePassShelf.get).toHaveBeenCalledWith('US');
+ // A public shelf never reads or verifies account access.
+ expect(f.accountLibrary.storeAccess).not.toHaveBeenCalled();
+ expect(f.accountLibrary.select).not.toHaveBeenCalled();
const access=await f.call('store-access');
expect(access).toMatchObject({configuredMarket:'neutral',market:'CZ'});
expect(f.accountLibrary.storeAccess).toHaveBeenCalledWith('neutral');
@@ -96,6 +102,8 @@ it('uses the public market only for an explicit public Store scope and keeps eve
it('keeps public metadata stable while account operations follow a market change',async()=>{
const f=fixture('main');
f.setMarket('DE');
+ await f.call('catalog-recent-gamepass');
+ expect(f.homeGamePassShelf.get).toHaveBeenCalledWith('US');
await f.call('game-details',{productId:'9PUBLICGAME1',scope:'public-store'});
expect(f.catalog.gameDetails).toHaveBeenLastCalledWith('9PUBLICGAME1','US');
await f.call('game-details',{productId:'9ACCOUNTGAME'});
@@ -114,6 +122,8 @@ it('demo applies the same scoped policy instead of an all-US catalog',async()=>{
expect(f.catalog.search).toHaveBeenCalledWith('gears','US','cursor');
await f.call('catalog-featured');
expect(f.catalog.featured).toHaveBeenCalledWith('US');
+ await f.call('catalog-recent-gamepass');
+ expect(f.homeGamePassShelf.get).toHaveBeenCalledWith('US');
await f.call('game-details',{productId:'9PUBLICGAME1',scope:'public-store'});
expect(f.catalog.gameDetails).toHaveBeenLastCalledWith('9PUBLICGAME1','US');
await f.call('game-details',{productId:'9ACCOUNTGAME'});
diff --git a/src/preload/index.cts b/src/preload/index.cts
index 1e1b3ff..c7bc740 100644
--- a/src/preload/index.cts
+++ b/src/preload/index.cts
@@ -123,6 +123,7 @@ const api: LauncherApi = {
setOfflinePermissions: (enabled: boolean) => ipcRenderer.invoke('set-offline-permissions', enabled),
searchCatalog: (query: string, cursor?: string) => ipcRenderer.invoke('catalog-search', query, cursor),
getFeaturedCatalog: () => ipcRenderer.invoke('catalog-featured'),
+ getRecentGamePassShelf: () => ipcRenderer.invoke('catalog-recent-gamepass'),
getStoreAccess: () => ipcRenderer.invoke('store-access'),
getAccountLibrary: (kind, cursor, refresh, sort) => ipcRenderer.invoke('account-library', kind, cursor, refresh, sort),
startInstall: (request: InstallRequest) => ipcRenderer.invoke('start-install', request),
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index f92f429..0a4c394 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -35,6 +35,8 @@ import { ConfirmationProvider, useConfirmation } from './Confirmation';
import { GameRemovalContents } from './GameRemovalContents';
import { GameDetails } from './GameDetails';
import {CatalogGameDetails,catalogGameInstalled,publicStorePrice} from './CatalogGameDetails';
+import {HomeGamePassSection,useRecentGamePassShelf} from './HomeGamePass';
+import {recentlyInstalledGames} from './home-shelves';
import { GameLanguage } from './GameLanguage';
import { DownloadCancelDialog } from './DownloadCancelDialog';
import { OfflinePermissionsCard } from './OfflinePermissions';
@@ -232,8 +234,8 @@ function useGameLaunchOptions(game: Game | undefined, data: AppSnapshot): GameLa
return options;
}
-export function HomePage({ data, go, action, openGame, returnFocusKey }: {
- data: AppSnapshot; go: (page: Page) => void; action: (fn: () => Promise<unknown>, success?: string) => void; openGame?: (id: string, returnKey: string) => void; returnFocusKey?: string;
+export function HomePage({ data, go, action, openGame, returnFocusKey, toast }: {
+ data: AppSnapshot; go: (page: Page) => void; action: (fn: () => Promise<unknown>, success?: string) => void; openGame?: (id: string, returnKey: string) => void; returnFocusKey?: string; toast?: (value: Toast) => void;
}) {
const featured = data.games[0];
const featuredRuntimeReady=useGameRuntimeReady(featured,data);
@@ -242,11 +244,42 @@ export function HomePage({ data, go, action, openGame, returnFocusKey }: {
const spotlightArt = featured?.heroUrl ?? featured?.coverUrl;
const home = useRef<HTMLElement>(null);
const initialFocusKey = useRef(returnFocusKey);
+ const recentInstalled = recentlyInstalledGames(data.games, data.downloads);
+ const gamePass = useRecentGamePassShelf();
+ const [gamePassProduct, setGamePassProduct] = useState<CatalogProduct>();
+ const [gamePassOpen, setGamePassOpen] = useState(false);
+ const gamePassAccess = useStoreAccess(data, gamePassOpen);
+ const homeScroll = useRef(0);
+ const gamePassWasOpen = useRef(false);
useBrowserLayoutEffect(() => {
if (document.activeElement?.closest('.sidebar')) return;
const returnTarget = [...home.current?.querySelectorAll<HTMLElement>('[data-gamepad-key]') ?? []].find(element => element.dataset.gamepadKey === initialFocusKey.current);
(returnTarget ?? home.current?.querySelector<HTMLElement>('[data-gamepad-home-primary]'))?.focus({ preventScroll: true });
}, []);
+ useBrowserLayoutEffect(() => {
+ const scroll = home.current?.closest('.page-scroll');
+ if (gamePassOpen && gamePassProduct) {
+ if (scroll) scroll.scrollTop = 0;
+ focusDetailEntry(home.current);
+ } else if (gamePassWasOpen.current) {
+ if (scroll) scroll.scrollTop = homeScroll.current;
+ [...home.current?.querySelectorAll<HTMLElement>('[data-gamepad-key]') ?? []]
+ .find(element => element.dataset.gamepadKey === `home-gamepass:${gamePassProduct?.productId}`)?.focus({ preventScroll: true });
+ }
+ gamePassWasOpen.current = gamePassOpen && Boolean(gamePassProduct);
+ }, [gamePassOpen, gamePassProduct?.productId]);
+
+ function openGamePass(product: CatalogProduct) {
+ homeScroll.current = home.current?.closest('.page-scroll')?.scrollTop ?? 0;
+ setGamePassProduct(product);
+ setGamePassOpen(true);
+ }
+
+ if (gamePassOpen && gamePassProduct) return <main ref={home} className="page home-page library-detail-open">
+ <CatalogGameDetails key={`${gamePassProduct.productId}:${data.auth.username}:${data.auth.player}:${data.auth.stored}:${data.auth.running}:${data.backend.binaryPath}:${data.settings.market}`}
+ product={gamePassProduct} data={data} storeMode storeAccess={gamePassAccess}
+ back={() => setGamePassOpen(false)} backLabel={ui('game.back_to_home')} toast={toast ?? (() => {})}/>
+ </main>;
return <main ref={home} className="page home-page">
<div className={`home-highlights${data.games.length>1?' has-secondary':''}`}>
@@ -271,12 +304,15 @@ export function HomePage({ data, go, action, openGame, returnFocusKey }: {
</button>)}</div>:null}
</div>
- <SectionTitle title={ui("ui.recently_added_96ec5d3")} action={ui("ui.see_all_d7a8c44")} onClick={() => go('library')} />
- {data.games.length > 0 ? <div className="poster-row">
- {data.games.slice(0, 6).map((game) => <button className="poster-card" key={game.id} data-gamepad-key={`home-poster:${game.id}`} onClick={() => openGame ? openGame(game.id, `home-poster:${game.id}`) : go('library')}>
+ <SectionTitle title={ui("ui.recently_installed_d12be06")} action={ui("ui.see_all_d7a8c44")} onClick={() => go('library')} />
+ {recentInstalled.length > 0 ? <div className="poster-row">
+ {recentInstalled.slice(0, 6).map((game) => <button className="poster-card" key={game.id} data-gamepad-key={`home-poster:${game.id}`} onClick={() => openGame ? openGame(game.id, `home-poster:${game.id}`) : go('library')}>
<Cover game={game} /><GameTitle title={game.title} /><span>{game.publisher ?? (game.storeId ? ui("ui.microsoft_store_installation_99bfa99") : ui("ui.local_installation_e5d8322"))}</span>
</button>)}
- </div> : <div className="empty-strip"><Gamepad2 /><div><strong>{ui("ui.no_games_imported_0bbcb51")}</strong><span>{ui("ui.your_library_is_built_only_from_real_local_manif_1513d78")}</span></div><button className="secondary" onClick={() => go('library')}>{ui("ui.import_folder_b849e38")}</button></div>}
+ </div> : data.games.length === 0 ? <div className="empty-strip"><Gamepad2 /><div><strong>{ui("ui.no_games_imported_0bbcb51")}</strong><span>{ui("ui.your_library_is_built_only_from_real_local_manif_1513d78")}</span></div><button className="secondary" onClick={() => go('library')}>{ui("ui.import_folder_b849e38")}</button></div>
+ : <div className="empty-strip"><Gamepad2 /><div><strong>{ui("ui.no_completed_installations_yet_c0d583a")}</strong><span>{ui("ui.your_library_is_built_only_from_real_local_manif_1513d78")}</span></div><button className="secondary" onClick={() => go('library')}>{ui("ui.view_library_108eb25")}</button></div>}
+
+ <HomeGamePassSection {...gamePass} open={openGamePass}/>
<div className="support-bar"><CircleAlert /><div><strong>{ui("ui.compatibility_status_65cfaa2")}</strong><span>{ui("ui.package_ownership_and_installation_do_not_guaran_af576d1")}</span></div></div>
</main>;
@@ -1322,7 +1358,7 @@ export default function App() {
<section className="content-shell">
<header className="topbar" ref={inertRef(socialOpen)}><GlobalSearch games={data.games} page={page} query={search} change={setSearch} submit={value => { setSubmittedSearch(value); go('store'); }} select={openLibraryGame} /><TopStatus data={data} go={go} /></header>
<CloudSaveWarning operation={data.gameOperation} openGame={openLibraryGame} disabled={socialOpen} />
- <div data-gamepad-page={page} ref={inertRef(socialOpen)} className={'page-scroll'+(page==='social'?' social-full-page':'')}>{page === 'home' ? <HomePage data={data} go={go} action={action} openGame={openLibraryGame} returnFocusKey={homeReturnKey} /> : null}{page === 'store' ? <StorePage data={data} toast={setToast} go={go} initialQuery={submittedSearch} /> : null}{page === 'library' ? <LibraryPage data={data} toast={setToast} filters={libraryFilters} onFiltersChange={changeLibraryFilters} selection={librarySelection} onSelectionHandled={request => setLibrarySelection(current => current === request ? undefined : current)} returnHome={key => { setHomeReturnKey(key); go('home'); }} /> : null}{page === 'downloads' ? <DownloadsPage data={data} toast={setToast} /> : null}{page === 'settings' ? <SettingsPage data={data} toast={setToast} /> : null}{page === 'social' ? <div className="nexus-social-page"><Suspense fallback={<SocialLoading/>}><XboxSocial key={JSON.stringify([data.auth.player??data.auth.username,data.backend.binaryPath])} auth={data.auth} api={window.launcher.nativeSocial} voice={data.backend.available&&data.backend.capabilities.nativeSocial?window.launcher:undefined} runtimeInvites={data.social} runtimeApi={window.launcher} expanded active={!socialOpen} readKeys={notifications.readKeys} onViewed={notifications.viewed} showProfile={desktopProfile}/></Suspense></div> : null}</div>
+ <div data-gamepad-page={page} ref={inertRef(socialOpen)} className={'page-scroll'+(page==='social'?' social-full-page':'')}>{page === 'home' ? <HomePage data={data} go={go} action={action} openGame={openLibraryGame} returnFocusKey={homeReturnKey} toast={setToast} /> : null}{page === 'store' ? <StorePage data={data} toast={setToast} go={go} initialQuery={submittedSearch} /> : null}{page === 'library' ? <LibraryPage data={data} toast={setToast} filters={libraryFilters} onFiltersChange={changeLibraryFilters} selection={librarySelection} onSelectionHandled={request => setLibrarySelection(current => current === request ? undefined : current)} returnHome={key => { setHomeReturnKey(key); go('home'); }} /> : null}{page === 'downloads' ? <DownloadsPage data={data} toast={setToast} /> : null}{page === 'settings' ? <SettingsPage data={data} toast={setToast} /> : null}{page === 'social' ? <div className="nexus-social-page"><Suspense fallback={<SocialLoading/>}><XboxSocial key={JSON.stringify([data.auth.player??data.auth.username,data.backend.binaryPath])} auth={data.auth} api={window.launcher.nativeSocial} voice={data.backend.available&&data.backend.capabilities.nativeSocial?window.launcher:undefined} runtimeInvites={data.social} runtimeApi={window.launcher} expanded active={!socialOpen} readKeys={notifications.readKeys} onViewed={notifications.viewed} showProfile={desktopProfile}/></Suspense></div> : null}</div>
{socialOpen?<button className="nexus-social-scrim" aria-label={ui("social.close_social_shelf_09c6eb")} onClick={()=>setSocialOpen(false)}/>:null}
<aside id="nexus-social-shelf" role="dialog" aria-modal={socialOpen || undefined} data-gamepad-layer data-gamepad-social-shelf className={'nexus-social-shelf'+(socialOpen?' is-open':'')} aria-label={ui("social.xbox_social_shelf_bb6aaf")} aria-hidden={!socialOpen}
ref={inertRef(!socialOpen)}>
diff --git a/src/renderer/HomeGamePass.tsx b/src/renderer/HomeGamePass.tsx
new file mode 100644
index 0000000..b6867e4
--- /dev/null
+++ b/src/renderer/HomeGamePass.tsx
@@ -0,0 +1,75 @@
+import {useEffect,useState} from 'react';
+import {CircleAlert,Gamepad2,LoaderCircle,RefreshCw} from 'lucide-react';
+import type {CatalogProduct,RecentGamePassShelf} from '../shared/types';
+import {ui} from './i18n';
+
+export interface RecentGamePassState {
+ shelf?: RecentGamePassShelf;
+ loading: boolean;
+ error?: string;
+}
+
+/** Public shelf data. It is independent of the signed-in account and is only
+ * refreshed by an explicit retry, never by each render or keystroke. */
+export function useRecentGamePassShelf(): RecentGamePassState & {retry:()=>void} {
+ const [state,setState]=useState<RecentGamePassState>({loading:true});
+ const [revision,setRevision]=useState(0);
+ useEffect(()=>{
+ let active=true;
+ setState(previous=>({shelf:previous.shelf,loading:true}));
+ const api=window.launcher as Window['launcher']&{getRecentGamePassShelf?:()=>Promise<RecentGamePassShelf>};
+ if(!api.getRecentGamePassShelf){
+ // Older test harnesses may not expose the optional channel.
+ setState({loading:false});
+ return;
+ }
+ void api.getRecentGamePassShelf().then(value=>{
+ if(!active)return;
+ const staleMessage=value.stale
+ ?value.products.length?ui('ui.showing_the_last_loaded_pc_game_pass_list_try_agai_4344aca'):ui('ui.the_pc_game_pass_catalog_could_not_be_loaded_check_9d5d552')
+ :undefined;
+ setState({shelf:value,loading:false,error:staleMessage});
+ }).catch(()=>{
+ if(!active)return;
+ setState(previous=>({shelf:previous.shelf,loading:false,
+ error:previous.shelf?.products.length
+ ?ui('ui.showing_the_last_loaded_pc_game_pass_list_try_agai_4344aca')
+ :ui('ui.the_pc_game_pass_catalog_could_not_be_loaded_check_9d5d552')}));
+ });
+ return ()=>{active=false;};
+ },[revision]);
+ return {...state,retry:()=>setRevision(value=>value+1)};
+}
+
+export function HomeGamePassSection({shelf,loading,error,retry,open}:RecentGamePassState&{
+ retry:()=>void;
+ open:(product:CatalogProduct)=>void;
+}) {
+ const products=shelf?.products??[];
+ return <section className="home-gamepass" aria-labelledby="home-gamepass-title" aria-busy={loading||undefined}>
+ <div className="section-title">
+ <h2 id="home-gamepass-title">{ui('ui.recently_added_in_game_pass_07849d1')}</h2>
+ {loading?<span className="shelf-loading" role="status" aria-label={ui('ui.loading_live_store_collection_20763b0')}><LoaderCircle className="spin"/></span>:null}
+ </div>
+ {products.length>0
+ ? <>
+ <div className="poster-row">
+ {products.map(product=><button className="poster-card home-gamepass-card" key={product.productId} data-gamepad-key={`home-gamepass:${product.productId}`}
+ onClick={()=>open(product)}>
+ {product.posterUrl
+ ?<img className="game-cover cover-store" src={product.posterUrl} alt={ui('ui.artwork_1bf7d06',{game:product.title})}/>
+ :<div className="cover-placeholder"><Gamepad2/></div>}
+ <strong title={product.title}>{product.title}</strong>
+ <span>{product.publisher??product.productId}</span>
+ <small className="gamepass-badge">{ui('ui.game_pass_5c83b40')}</small>
+ </button>)}
+ </div>
+ {error?<div className="shelf-warning" role="status"><CircleAlert/><span>{error}</span><button onClick={retry}><RefreshCw/>{ui('ui.try_again_d8b839')}</button></div>:null}
+ </>
+ : loading
+ ? <div className="catalog-loading" role="status"><LoaderCircle className="spin"/><span>{ui('ui.loading_live_store_collection_20763b0')}</span></div>
+ : error
+ ? <div className="catalog-empty" role="alert"><CircleAlert/><h2>{error}</h2><button className="secondary" onClick={retry}><RefreshCw/>{ui('ui.try_again_d8b839')}</button></div>
+ : <div className="catalog-empty" role="status"><Gamepad2/><h2>{ui('ui.no_new_pc_game_pass_games_are_available_right_now_08d8175')}</h2></div>}
+ </section>;
+}
diff --git a/src/renderer/app-navigation.test.tsx b/src/renderer/app-navigation.test.tsx
index 2528b1d..378d4a3 100644
--- a/src/renderer/app-navigation.test.tsx
+++ b/src/renderer/app-navigation.test.tsx
@@ -175,7 +175,9 @@ it.each(['.home-feature-card', '.poster-card'])('opens the clicked Home game and
});
it('falls back to Back to Home when the selected game cannot be played', async () => {
- const game = demoSnapshot().games.find(game => game.installState === 'incomplete')!;
+ // Incomplete installations are not part of the Recently installed shelf.
+ await emitSnapshot(data => { data.runtime.winePath = ''; data.settings.winePath = ''; });
+ const game = demoSnapshot().games.find(game => game.installState === 'ready')!;
await click(`[data-gamepad-key="home-poster:${game.id}"]`);
expect(get('[data-gamepad-play]').matches(':disabled')).toBe(true);
expect(document.activeElement).toBe(get('[data-gamepad-detail-back]'));
diff --git a/src/renderer/home-gamepass.test.tsx b/src/renderer/home-gamepass.test.tsx
new file mode 100644
index 0000000..8fd9aed
--- /dev/null
+++ b/src/renderer/home-gamepass.test.tsx
@@ -0,0 +1,106 @@
+// @vitest-environment jsdom
+import {act} from 'react';
+import {createRoot,type Root} from 'react-dom/client';
+import {renderToStaticMarkup} from 'react-dom/server';
+import {afterEach,beforeEach,expect,it,vi} from 'vitest';
+import type {AppSnapshot,CatalogProduct,RecentGamePassShelf} from '../shared/types';
+import {demoLaunchOptions,demoSnapshot} from '../shared/demo-data';
+import {HomeGamePassSection} from './HomeGamePass';
+import {HomePage} from './App';
+
+const product:CatalogProduct={productId:'9AAAAAA00001',title:'Fresh Game Pass Game',description:'Description',publisher:'Studio',
+ installability:'supported',supportNote:'Windows.Desktop MSIXVC',categories:[],posterUrl:'https://store-images.s-microsoft.com/box'};
+const shelf:RecentGamePassShelf={market:'US',fetchedAt:'2026-11-04T10:00:00.000Z',source:'Microsoft Game Pass catalog',
+ products:[product,{...product,productId:'9BBBBBB00002',title:'Second Game Pass Game',publisher:'Other Studio'}]};
+
+it('renders loading, empty, error and public Game Pass cards without an install action',()=>{
+ const loading=renderToStaticMarkup(<HomeGamePassSection loading retry={()=>{}} open={()=>{}}/>);
+ expect(loading).toContain('Recently added in Game Pass');
+ expect(loading).toContain('Loading live Store collection');
+ const empty=renderToStaticMarkup(<HomeGamePassSection loading={false} retry={()=>{}} open={()=>{}}/>);
+ expect(empty).toContain('No new PC Game Pass games are available right now.');
+ const failed=renderToStaticMarkup(<HomeGamePassSection loading={false} error="The PC Game Pass catalog could not be loaded. Check your connection and try again." retry={()=>{}} open={()=>{}}/>);
+ expect(failed).toContain('role="alert"');expect(failed).toContain('Try again');
+ const cards=renderToStaticMarkup(<HomeGamePassSection shelf={shelf} loading={false} retry={()=>{}} open={()=>{}}/>);
+ expect(cards).toContain('home-gamepass-card');expect(cards).toContain(product.title);expect(cards).toContain('Game Pass');
+ expect(cards.match(/home-gamepass-card/g)).toHaveLength(2);
+ expect(cards).not.toContain('Install</button>');
+});
+
+let root:Root|undefined;
+let node:HTMLDivElement|undefined;
+
+beforeEach(()=>{
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT',true);
+ node=document.createElement('div');document.body.appendChild(node);
+});
+afterEach(async()=>{
+ if(root)await act(async()=>root!.unmount());
+ root=undefined;node?.remove();node=undefined;vi.restoreAllMocks();document.body.innerHTML='';
+});
+
+function install(data:AppSnapshot){
+ const getStoreAccess=vi.fn(async()=>undefined);
+ const getRecentGamePassShelf=vi.fn(async()=>shelf);
+ window.launcher={
+ getRecentGamePassShelf,
+ getStoreAccess,
+ getGameLaunchOptions:vi.fn(async()=>demoLaunchOptions),
+ getGameDetails:vi.fn(async()=>undefined),
+ getGameActivity:vi.fn(async()=>({status:'unavailable'})),
+ getGameAchievements:vi.fn(async()=>({status:'unavailable'})),
+ getGameRuntimeReadiness:vi.fn(async()=>false),
+ } as unknown as Window['launcher'];
+ return {getStoreAccess,getRecentGamePassShelf};
+}
+const flush=async()=>{await act(async()=>{await Promise.resolve();await Promise.resolve();});};
+
+it('loads the public shelf once, opens public details through the normal Store access check and restores focus',async()=>{
+ const data=demoSnapshot();data.downloads=[];data.games=[data.games[0],{...data.games[1],installState:'incomplete'},{...data.games[2],installState:'imported'}];
+ const api=install(data);root=createRoot(node!);
+ await act(async()=>root!.render(<HomePage data={data} go={()=>{}} action={()=>{}} toast={()=>{}}/>));
+ await flush();
+ expect(document.body.textContent).toContain('Recently installed');
+ expect(document.body.textContent).toContain('Recently added in Game Pass');
+ expect(document.querySelectorAll('.home-gamepass-card')).toHaveLength(2);
+ expect(document.querySelector('.poster-row')?.textContent).not.toContain('Sea of Thieves');
+ expect(api.getRecentGamePassShelf).toHaveBeenCalledTimes(1);
+ expect(api.getStoreAccess).not.toHaveBeenCalled();
+ const card=document.querySelector<HTMLButtonElement>('[data-gamepad-key="home-gamepass:9AAAAAA00001"]');
+ expect(card).not.toBeNull();
+ await act(async()=>card!.click());
+ await flush();
+ expect(api.getStoreAccess).toHaveBeenCalledTimes(1);
+ expect(document.querySelector('[data-gamepad-detail-back]')?.textContent).toContain('Back to Home');
+ expect(document.body.textContent).toContain('Store page');
+ expect(document.body.innerHTML).not.toContain('>Install</button>');
+ const back=document.querySelector<HTMLButtonElement>('[data-gamepad-detail-back]');
+ await act(async()=>back!.click());
+ await flush();
+ expect(document.activeElement).toBe(document.querySelector('[data-gamepad-key="home-gamepass:9AAAAAA00001"]'));
+ expect(api.getRecentGamePassShelf).toHaveBeenCalledTimes(1);
+});
+
+it('does not refetch the public shelf when an unrelated snapshot rerenders Home',async()=>{
+ const data=demoSnapshot();data.downloads=[];
+ const api=install(data);root=createRoot(node!);
+ await act(async()=>root!.render(<HomePage data={data} go={()=>{}} action={()=>{}}/>));
+ await flush();
+ const next=structuredClone(data);next.connectivity={state:'offline',checkedAt:'2026-11-04T11:00:00.000Z'};
+ await act(async()=>root!.render(<HomePage data={next} go={()=>{}} action={()=>{}}/>));
+ await flush();
+ expect(api.getRecentGamePassShelf).toHaveBeenCalledTimes(1);
+});
+
+it('ignores a shelf response after Home unmounts',async()=>{
+ const data=demoSnapshot();data.downloads=[];
+ let resolve!: (value:RecentGamePassShelf)=>void;
+ const getRecentGamePassShelf=vi.fn(()=>new Promise<RecentGamePassShelf>(done=>{resolve=done;}));
+ window.launcher={getRecentGamePassShelf,getGameLaunchOptions:vi.fn(async()=>demoLaunchOptions)} as unknown as Window['launcher'];
+ root=createRoot(node!);
+ await act(async()=>root!.render(<HomePage data={data} go={()=>{}} action={()=>{}}/>));
+ await act(async()=>root!.unmount());
+ root=undefined;
+ await act(async()=>resolve(shelf));
+ expect(node!.textContent).toBe('');
+});
diff --git a/src/renderer/home-onboarding.test.tsx b/src/renderer/home-onboarding.test.tsx
index 520fb1e..d77e3f1 100644
--- a/src/renderer/home-onboarding.test.tsx
+++ b/src/renderer/home-onboarding.test.tsx
@@ -4,7 +4,7 @@ import {demoSnapshot} from '../shared/demo-data';
import {HomePage} from './App';
it('uses real library highlights instead of duplicating sidebar shortcuts',()=>{
const data=demoSnapshot(),html=renderToStaticMarkup(<HomePage data={data} go={()=>{}} action={()=>{}} />);
- expect(html).toContain('home-highlights');expect(html).toContain('Recently added');
+ expect(html).toContain('home-highlights');expect(html).toContain('Recently installed');expect(html).toContain('Recently added in Game Pass');
expect(html).not.toContain('Quick access');expect(html).not.toContain('quick-grid');
expect(html).toContain(data.games[0].title);
});
diff --git a/src/renderer/home-shelves.test.ts b/src/renderer/home-shelves.test.ts
new file mode 100644
index 0000000..e4efabb
--- /dev/null
+++ b/src/renderer/home-shelves.test.ts
@@ -0,0 +1,31 @@
+import {expect,it} from 'vitest';
+import type {DownloadTask,Game} from '../shared/types';
+import {recentlyInstalledGames} from './home-shelves';
+
+const game=(id:string,addedAt:string,installState:Game['installState']='ready',installedAt?:string,storeId?:string):Game=>
+ ({id,title:id,path:`/${id}`,installState,addedAt,...(installedAt?{installedAt}:{}),...(storeId?{storeId}:{})});
+const download=(patch:Partial<DownloadTask>):DownloadTask=>({id:'task',title:'Task',productId:'9AAAAAAAAAAA',destination:'/games',status:'running',progress:null,phase:'',log:[],startedAt:'',...patch});
+
+it('keeps complete and imported local games but hides incomplete installations and active downloads',()=>{
+ const games=[game('ready','2025-01-01'),game('imported','2025-01-02','imported'),game('incomplete','2025-01-03','incomplete'),
+ game('updating','2025-01-04','ready',undefined,'9BBBBBBBBBBB')];
+ const downloads=[download({gameId:'ready'}),download({productId:'9bbbbbbbbbbb'}),
+ download({kind:'content',gameId:'imported',productId:'9CCCCCCCCCCC'})];
+ expect(recentlyInstalledGames(games,downloads).map(item=>item.id)).toEqual(['imported']);
+});
+
+it('prefers the recorded installation time and falls back to saved order without inventing dates',()=>{
+ const games=[game('legacy-old','2025-01-01'),game('newer','2025-01-02',undefined, '2026-02-01T00:00:00.000Z'),
+ game('legacy-new','2025-01-03'),game('invalid','2025-01-04','ready','not a date'),game('missing','')];
+ const result=recentlyInstalledGames(games);
+ expect(result.map(item=>item.id)).toEqual(['newer','invalid','legacy-new','legacy-old','missing']);
+ expect(result.find(item=>item.id==='legacy-new')?.installedAt).toBeUndefined();
+ expect(result.find(item=>item.id==='missing')?.installedAt).toBeUndefined();
+});
+
+it('keeps the saved order on equal timestamps and never mutates the library',()=>{
+ const games=[game('first','2026-01-01T00:00:00.000Z'),game('second','2026-01-01T00:00:00.000Z'),game('third','2026-01-01T00:00:00.000Z')];
+ const before=games.map(item=>item.id);
+ expect(recentlyInstalledGames(games).map(item=>item.id)).toEqual(['first','second','third']);
+ expect(games.map(item=>item.id)).toEqual(before);
+});
diff --git a/src/renderer/home-shelves.ts b/src/renderer/home-shelves.ts
new file mode 100644
index 0000000..7bc8dec
--- /dev/null
+++ b/src/renderer/home-shelves.ts
@@ -0,0 +1,42 @@
+import type { DownloadTask, Game } from '../shared/types';
+
+const ACTIVE_DOWNLOAD = new Set<DownloadTask['status']>(['running', 'queued', 'paused']);
+
+function recordedTime(value: unknown): number | undefined {
+ if (typeof value !== 'string' || !value) return;
+ const parsed = Date.parse(value);
+ return Number.isFinite(parsed) ? parsed : undefined;
+}
+
+/**
+ * Complete local games for the Home "Recently installed" shelf.
+ *
+ * New installations may carry an explicit completion time. Older games have
+ * no installation timestamp: their saved `addedAt` (the library entry time) is
+ * only an ordering approximation and is never shown as a date. Imports remain
+ * visible, incomplete installations and games with an active download are not.
+ */
+export function recentlyInstalledGames(games: readonly Game[], downloads: readonly DownloadTask[] = []): Game[] {
+ const active = new Set<string>();
+ for (const task of downloads) {
+ if (!ACTIVE_DOWNLOAD.has(task.status) || task.kind === 'content') continue;
+ if (task.gameId) active.add(task.gameId);
+ if (task.productId) active.add(task.productId.toUpperCase());
+ }
+ return games
+ .map((game, index) => ({ game, index }))
+ .filter(({ game }) => game.installState !== 'incomplete'
+ && !active.has(game.id)
+ && !(game.storeId && active.has(game.storeId.toUpperCase())))
+ .map((entry) => ({
+ ...entry,
+ time: recordedTime(entry.game.installedAt) ?? recordedTime(entry.game.addedAt),
+ }))
+ .sort((a, b) => {
+ if (a.time !== undefined && b.time !== undefined && a.time !== b.time) return b.time - a.time;
+ if (a.time !== undefined && b.time === undefined) return -1;
+ if (a.time === undefined && b.time !== undefined) return 1;
+ return a.index - b.index;
+ })
+ .map(entry => entry.game);
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 3651b22..4f77ff1 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -185,6 +185,15 @@ button.primary svg, button.secondary svg { width: 17px; height: 17px; }
.poster-card:hover .game-cover, .poster-card:hover .cover-placeholder { transform: translateY(-3px); outline: 2px solid rgba(255,255,255,.6); }
.poster-card strong { display: block; margin-top: 9px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster-card > span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.poster-card .gamepass-badge { display: inline-block; margin-top: 6px; padding: 1px 6px; border: 1px solid #6f9e57; border-radius: 999px; color: #b9e29f; font-size: 9px; line-height: 1.5; }
+.section-title .shelf-loading { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
+.section-title .shelf-loading svg { width: 13px; }
+.shelf-warning { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px; border: 1px solid #6b5e35; background: #2a271c; color: #e8d9a8; font-size: 10px; }
+.shelf-warning svg { width: 14px; flex: none; }
+.shelf-warning span { flex: 1; }
+.shelf-warning button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #8b7b48; background: transparent; color: inherit; padding: 3px 8px; cursor: pointer; font-size: 10px; }
+.shelf-warning button svg { width: 12px; }
+.catalog-empty button.secondary { margin-top: 14px; }
.game-cover, .cover-placeholder { width: 100%; object-fit: cover; background: #30343a; }
.game-cover.cover-local { object-fit: contain; }
.cover-placeholder { display: grid; place-items: center; color: #91969c; }
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 53a1213..752852d 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -158,6 +158,9 @@ export interface Game {
encryptedTarget: boolean;
};
addedAt: string;
+ /** Completion of a genuine new installation. Older profiles and imports have
+ * no value, so presentation must not treat `addedAt` as proof of installation. */
+ installedAt?: string;
}
export interface GameLaunchOptions {
@@ -459,6 +462,16 @@ export interface CatalogSearchResult {
source: 'Microsoft Store';
}
+/** Public presence in the official PC Game Pass recent collection.
+ * This is not an owned Library page and grants no account access. */
+export interface RecentGamePassShelf {
+ market: string;
+ products: CatalogProduct[];
+ fetchedAt: string;
+ source: 'Microsoft Game Pass catalog';
+ stale?: boolean;
+}
+
export type LibraryAccess = 'owned' | 'gamepass' | 'other';
export interface StoreAccess {
configuredMarket: string;
@@ -663,6 +676,7 @@ export interface LauncherApi {
setOfflinePermissions(enabled: boolean): Promise<OfflinePermissions>;
searchCatalog(query: string, cursor?: string): Promise<CatalogSearchResult>;
getFeaturedCatalog(): Promise<CatalogSearchResult>;
+ getRecentGamePassShelf(): Promise<RecentGamePassShelf>;
getStoreAccess(): Promise<StoreAccess>;
getAccountLibrary(kind: AccountLibraryPage['kind'], cursor?: string, refresh?: boolean, sort?: AccountLibraryPage['sort']): Promise<AccountLibraryPage>;
startInstall(request: InstallRequest): Promise<string>;