Skip to content

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

TypeScript

feat(launcher): prepare Nexus Launcher branding with stable identity

domsvobodac91810df7bd5
diff --git a/package.json b/package.json
index 2f56046..6f737d8 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"name": "xodus-nexus",
+ "productName": "Nexus Launcher",
"desktopName": "org.xodusgaming.nexus.desktop",
"version": "0.4.2",
"description": "Xbox-inspired Microsoft Store game launcher for Linux",
@@ -50,7 +51,7 @@
},
"build": {
"appId": "org.xodusgaming.nexus",
- "productName": "Xodus Nexus",
+ "productName": "Nexus Launcher",
"artifactName": "Xodus-Nexus-${version}-${arch}.${ext}",
"directories": {
"output": "release"
@@ -67,6 +68,7 @@
"extraResources": [{ "from": "assets/fonts", "to": "fonts" },{ "from": "assets/overlay", "to": "overlay", "filter": ["*.py"] }],
"afterPack": "scripts/launcher-fonts-after-pack.cjs",
"linux": {
+ "executableName": "xodus-nexus",
"category": "Game",
"icon": "assets/icon.png",
"target": [
diff --git a/scripts/ci/install-rename.test.mjs b/scripts/ci/install-rename.test.mjs
new file mode 100644
index 0000000..ccedb00
--- /dev/null
+++ b/scripts/ci/install-rename.test.mjs
@@ -0,0 +1,24 @@
+import {test} from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs/promises';
+import os from 'node:os';
+import path from 'node:path';
+import {spawnSync} from 'node:child_process';
+import {fileURLToPath} from 'node:url';
+const script=fileURLToPath(new URL('../install.sh',import.meta.url));
+test('renamed installation keeps existing locations, command, desktop identity and saved state',async t=>{
+ const root=await fs.mkdtemp(path.join(os.tmpdir(),'nexus-install-rename-'));t.after(()=>fs.rm(root,{recursive:true,force:true}));
+ const prefix=root+'/prefix with spaces',data=root+'/data',app=prefix+'/opt/xodus-nexus',tools=root+'/tools';
+ for(const dir of [app,data+'/applications',tools])await fs.mkdir(dir,{recursive:true});
+ await fs.writeFile(app+'/Xodus-Nexus.AppImage','old launcher');await fs.writeFile(root+'/new.AppImage','synthetic new launcher');
+ await fs.writeFile(data+'/applications/xodus-nexus.desktop','[Desktop Entry]\nName=Xodus Nexus\n');
+ const saved=[root+'/.config/xodus-nexus/launcher-state.json',data+'/xodus-nexus/runtimes/current.json',root+'/Games/Xodus Nexus/Existing/save.dat'];
+ for(const file of saved){await fs.mkdir(path.dirname(file),{recursive:true});await fs.writeFile(file,'keep');}
+ await fs.writeFile(tools+'/curl','#!/bin/sh\nwhile [ "$#" -gt 0 ]; do if [ "$1" = "-o" ]; then shift; output="$1"; fi; shift; done\nprintf icon > "$output"\n',{mode:0o700});
+ await fs.writeFile(tools+'/update-desktop-database','#!/bin/sh\nexit 0\n',{mode:0o700});
+ const run=spawnSync('bash',[script],{env:{...process.env,HOME:root,PATH:tools+':'+process.env.PATH,XODUS_NEXUS_PREFIX:prefix,XDG_DATA_HOME:data,XODUS_NEXUS_APPIMAGE:root+'/new.AppImage',XODUS_NEXUS_SKIP_DEPS:'1'},encoding:'utf8'});
+ assert.equal(run.status,0,run.stderr);assert.equal(await fs.readFile(app+'/Xodus-Nexus.AppImage','utf8'),'synthetic new launcher');
+ assert.equal(await fs.readlink(prefix+'/bin/xodus-nexus'),app+'/Xodus-Nexus.AppImage');
+ const entry=await fs.readFile(data+'/applications/xodus-nexus.desktop','utf8');assert.match(entry,/^Name=Nexus Launcher$/m);assert.match(entry,/^StartupWMClass=xodus-nexus$/m);assert.ok(entry.includes('Exec='+prefix+'/bin/xodus-nexus %U'));
+ assert.deepEqual(await fs.readdir(data+'/applications'),['xodus-nexus.desktop']);for(const file of saved)assert.equal(await fs.readFile(file,'utf8'),'keep');
+});
diff --git a/scripts/ci/uninstall.test.mjs b/scripts/ci/uninstall.test.mjs
index 585901f..3499382 100644
--- a/scripts/ci/uninstall.test.mjs
+++ b/scripts/ci/uninstall.test.mjs
@@ -92,3 +92,9 @@ test('active updates and invalid options cannot delete an installation', async t
await fs.writeFile(`${f.image}.nexus-update.lock`, '-1'); assert.equal(f.run().status, 1);
await fs.writeFile(`${f.image}.nexus-update.lock`, '999999999'); assert.equal(f.run().status, 0);
});
+
+test('renamed display labels keep installer identities and leave saved data intact',async t=>{
+ const f=await fixture(t);const desktop=path.join(f.root,'.local/share/applications/xodus-nexus.desktop');
+ await fs.writeFile(desktop,(await fs.readFile(desktop,'utf8')).replace('Name=Xodus Nexus','Name=Nexus Launcher'));
+ const result=f.run();assert.equal(result.status,0,result.stderr);await absent(f.image);await absent(desktop);await f.kept();
+});
diff --git a/scripts/install.sh b/scripts/install.sh
index 52e7c2b..72cde81 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Xodus Nexus user installer.
+# Nexus Launcher user installer.
#
# One-liner (once the repository is public):
# curl -fsSL https://raw.githubusercontent.com/domsvoboda/xodus-nexus/main/scripts/install.sh | bash
@@ -8,7 +8,7 @@
# 1. Installs system prerequisites with your package manager (skip with
# XODUS_NEXUS_SKIP_DEPS=1): backend sign-in and Electron runtime libraries.
# Rust/Cargo/protoc are not needed for the prebuilt backend.
-# 2. Downloads the latest Xodus Nexus AppImage from GitHub Releases.
+# 2. Downloads the latest Nexus Launcher AppImage from GitHub Releases.
# 3. Installs it to ~/.local/opt/xodus-nexus, links it into ~/.local/bin
# and registers a desktop entry with the app icon.
#
@@ -133,7 +133,7 @@ ln -sf "$target" "$BIN_DIR/xodus-nexus"
cat > "$DESKTOP_DIR/xodus-nexus.desktop" <<EOF
[Desktop Entry]
Type=Application
-Name=Xodus Nexus
+Name=Nexus Launcher
Comment=Open-source Xbox-inspired game launcher
Exec=$BIN_DIR/xodus-nexus %U
Icon=$APP_DIR/icon.png
@@ -148,11 +148,11 @@ case ":$PATH:" in
*) warn "Add $BIN_DIR to PATH to run 'xodus-nexus' from a terminal (usually already in ~/.profile)." ;;
esac
-log "Xodus Nexus installed."
+log "Nexus Launcher installed."
cat <<'EOF'
First run:
- 1. Start Xodus Nexus from your application menu (or: xodus-nexus).
+ 1. Start Nexus Launcher from your application menu (or: xodus-nexus).
2. In Settings -> Xodus backend, click Install backend.
This downloads and verifies our patched, prebuilt Xodus backend; no compiler needed.
3. In Settings -> Nexus runtime, click Install Nexus runtime.
diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh
index ea86e75..150892b 100755
--- a/scripts/uninstall.sh
+++ b/scripts/uninstall.sh
@@ -69,7 +69,7 @@ elif [[ -e "$nexus_command" ]]; then
warn "command not created by the installer: $nexus_command"
fi
if [[ -f "$nexus_desktop" && ! -L "$nexus_desktop" ]]; then
- if grep -Fxq -- 'Name=Xodus Nexus' "$nexus_desktop" &&
+ if { grep -Fxq -- 'Name=Xodus Nexus' "$nexus_desktop" || grep -Fxq -- 'Name=Nexus Launcher' "$nexus_desktop"; } &&
grep -Fxq -- "Exec=$nexus_prefix/bin/xodus-nexus %U" "$nexus_desktop" &&
grep -Fxq -- "Icon=$nexus_app/icon.png" "$nexus_desktop"; then
remove_file "$nexus_desktop"
diff --git a/src/main/arch.ts b/src/main/arch.ts
index 9d9ec2c..1fceefd 100644
--- a/src/main/arch.ts
+++ b/src/main/arch.ts
@@ -15,7 +15,7 @@ export function nexusArch(arch: string = process.arch): NexusArch | undefined {
/** The architecture this launcher process runs as; its downloads must match it. */
export function currentArch(arch: string = process.arch): NexusArch {
const supported = nexusArch(arch);
- if (!supported) throw new Error(`Xodus Nexus does not support ${arch} hosts.`);
+ if (!supported) throw new Error(`Nexus Launcher does not support ${arch} hosts.`);
return supported;
}
diff --git a/src/main/auth-window.ts b/src/main/auth-window.ts
index 9abfa7e..b9d870f 100644
--- a/src/main/auth-window.ts
+++ b/src/main/auth-window.ts
@@ -42,7 +42,7 @@ export function authViewFactory(parent?: BrowserWindow, testSession?: Session, r
width: 580, height: 760, parent, show: false, title: localize('Xodus sign in'), autoHideMenuBar: true,
webPreferences: { session: isolated, preload: path.join(folder, '../preload/auth.cjs'), nodeIntegration: false, contextIsolation: true,
additionalArguments: ['--nexus-auth-ui=' + JSON.stringify({
- label: localize('Xodus Nexus passkey help'), title: localize('Passkey taking too long?'),
+ label: localize('Nexus Launcher passkey help'), title: localize('Passkey taking too long?'),
help: localize('If your account uses a passkey or security key, continue in Google Chrome. Or cancel this request to choose another method.'),
browser: localize('Continue in browser'), cancel: localize('Cancel passkey request'),
error: localize('Could not open browser sign-in. Google Chrome must be installed. Try again or choose another method.'),
diff --git a/src/main/backend-migration.test.ts b/src/main/backend-migration.test.ts
index e7268e7..c8b4802 100644
--- a/src/main/backend-migration.test.ts
+++ b/src/main/backend-migration.test.ts
@@ -2,7 +2,7 @@ import {describe,it,expect,vi} from 'vitest';
import {promises as fs} from 'node:fs';
import os from 'node:os';
import path from 'node:path';
-import {BACKEND_REPOSITORY as fork,LEGACY_BACKEND_REPOSITORY as legacy,backendPackageName,minimumBackendVersion} from './backend-package.js';
+import {BACKEND_REPOSITORY as fork,LEGACY_BACKEND_REPOSITORY as legacy,RENAMED_LEGACY_BACKEND_REPOSITORY as renamed,backendPackageName,minimumBackendVersion} from './backend-package.js';
import {discoverBackend,installBackend} from './backend-releases.js';
import {currentArch} from './arch.js';
const sha='a'.repeat(128);
@@ -12,12 +12,12 @@ const release=(repo:string,version:string)=>({tag_name:`backend-v${version}`,ass
const manifest=(repo:string,version:string)=>({schema:repo===fork?2:1,...(repo===fork?{sourceRepository:fork}:{}),authUi:'electron',version,
commit:'b'.repeat(40),recipeSha256:'c'.repeat(64),compatibility:'linux-run-v25',platform:'linux',arch:currentArch(),
archive:backendPackageName(version)+'.tar.xz',archiveSha512:sha,files:Object.fromEntries(['LICENSE','xodus-cli','xodus-service'].map(name=>[name,'d'.repeat(64)]))});
-function fixture(forkVersion:string|number|null,legacyVersion:string|null,override:Record<string,unknown>={}) {
+function fixture(forkVersion:string|number|null,legacyVersion:string|null,override:Record<string,unknown>={},legacyHost:string=legacy) {
return vi.fn(async(input:URL|RequestInfo)=>{
const url=String(input);
const repo=url.includes(fork)?fork:legacy;
const version=repo===fork?forkVersion:legacyVersion;
- if(url.includes('/releases?')) return typeof version==='number'?new Response('',{status:version}):new Response(JSON.stringify(version?[release(repo,version)]:[]));
+ if(url.includes('/releases?')) return typeof version==='number'?new Response('',{status:version}):new Response(JSON.stringify(version?[release(repo===legacy?legacyHost:repo,version)]:[]));
if(typeof version!=='string')throw Error('unexpected fixture download');
if(url.endsWith('.manifest.json'))return new Response(JSON.stringify({...manifest(repo,version),...override}));
if(url.endsWith('.sha512sum'))return new Response(`${sha} ${backendPackageName(version)}.tar.xz\n`);
@@ -59,3 +59,13 @@ describe('backend repository migration',()=>{
} finally {await fs.rm(root,{recursive:true,force:true});}
});
});
+
+it('accepts coherent legacy backend assets redirected to the fixed renamed launcher repository',async()=>{
+ const artifact=await discoverBackend(fixture(null,'0.2.14',{},renamed));expect(artifact.repository).toBe(renamed);expect(artifact.manifest.schema).toBe(1);expect(artifact.archiveUrl).toContain('/domsvoboda/nexus-launcher/releases/download/backend-v0.2.14/');
+});
+it('rejects mixed old/new legacy backend release assets before reading metadata',async()=>{
+ const base=fixture(null,'0.2.14',{},renamed);const fetcher=(async(input:URL|RequestInfo)=>{
+ const response=await base(input);if(String(input).includes('/xodus-nexus/releases?')){const rows=await response.json();rows[0].assets[1].browser_download_url=rows[0].assets[1].browser_download_url.replace(renamed,legacy);return new Response(JSON.stringify(rows));}return response;
+ }) as typeof fetch;
+ await expect(discoverBackend(fetcher)).rejects.toThrow('Unexpected backend release asset URL');
+});
diff --git a/src/main/backend-package.ts b/src/main/backend-package.ts
index 901206c..96e16b9 100644
--- a/src/main/backend-package.ts
+++ b/src/main/backend-package.ts
@@ -3,8 +3,10 @@ import { BACKEND_ARCH_SUFFIX, currentArch, type NexusArch } from './arch.js';
export const BACKEND_REPOSITORY = 'domsvoboda/nexus-backend';
export const LEGACY_BACKEND_REPOSITORY = 'domsvoboda/xodus-nexus';
+export const RENAMED_LEGACY_BACKEND_REPOSITORY = 'domsvoboda/nexus-launcher';
+export const LEGACY_BACKEND_REPOSITORIES = [LEGACY_BACKEND_REPOSITORY, RENAMED_LEGACY_BACKEND_REPOSITORY] as const;
export const BACKEND_REPOSITORIES = [BACKEND_REPOSITORY, LEGACY_BACKEND_REPOSITORY] as const;
-export type BackendRepository = typeof BACKEND_REPOSITORIES[number];
+export type BackendRepository = typeof BACKEND_REPOSITORIES[number] | typeof RENAMED_LEGACY_BACKEND_REPOSITORY;
export const backendLock = JSON.parse(readFileSync(new URL('../../assets/backend-source.lock.json', import.meta.url), 'utf8')) as {
schema: 2; version: string; minimumVersion: string; repository: string; commit: string; rust: string;
cargoLockSha256: string; buildConfigSha256: string; compatibility: string;
@@ -32,7 +34,7 @@ export interface BackendPackageManifest {
export function validateBackendManifest(value: unknown, arch: NexusArch = currentArch(), repository?: BackendRepository): BackendPackageManifest {
const item = value as BackendPackageManifest | undefined;
if (!item || ![1, 2].includes(item.schema) ||
- (item.schema === 1 && (item.sourceRepository !== undefined || (repository && repository !== LEGACY_BACKEND_REPOSITORY))) ||
+ (item.schema === 1 && (item.sourceRepository !== undefined || (repository && !LEGACY_BACKEND_REPOSITORIES.some(repo => repo === repository)))) ||
(item.schema === 2 && (item.sourceRepository !== BACKEND_REPOSITORY || (repository && repository !== BACKEND_REPOSITORY))) || item.authUi !== 'electron' || !/^\d+\.\d+\.\d+$/.test(item.version ?? '') ||
compareVersions(item.version, minimumBackendVersion) < 0 ||
!/^[a-f0-9]{40}$/.test(item.commit ?? '') || !/^[a-f0-9]{64}$/.test(item.recipeSha256 ?? '') ||
@@ -47,7 +49,7 @@ export function validateBackendManifest(value: unknown, arch: NexusArch = curren
}
export function backendAssetUrl(tag: string, name: string, url: unknown, repository: BackendRepository = BACKEND_REPOSITORY): string {
- if (!BACKEND_REPOSITORIES.includes(repository)) throw new Error('Unexpected backend repository.');
+ if (![...BACKEND_REPOSITORIES, RENAMED_LEGACY_BACKEND_REPOSITORY].includes(repository)) throw new Error('Unexpected backend repository.');
const expected = `https://github.com/${repository}/releases/download/${encodeURIComponent(tag)}/${name}`;
if (url !== expected) throw new Error('Unexpected backend release asset URL.');
return expected;
diff --git a/src/main/backend-releases.ts b/src/main/backend-releases.ts
index 0fee187..a590f39 100644
--- a/src/main/backend-releases.ts
+++ b/src/main/backend-releases.ts
@@ -3,7 +3,7 @@ import { createHash, randomUUID } from 'node:crypto';
import path from 'node:path';
import { run } from './process.js';
import {
- BACKEND_REPOSITORIES, type BackendRepository, backendPackageName, backendAssetUrl, compareVersions, minimumBackendVersion,
+ BACKEND_REPOSITORIES, BACKEND_REPOSITORY, LEGACY_BACKEND_REPOSITORIES, type BackendRepository, backendPackageName, backendAssetUrl, compareVersions, minimumBackendVersion,
validateBackendManifest, validateBackendArchive, type BackendPackageManifest,
} from './backend-package.js';
import { BACKEND_ARCH_SUFFIX, currentArch, isLinuxElf64, nexusArch, type NexusArch } from './arch.js';
@@ -54,8 +54,15 @@ export async function discoverBackend(fetcher: typeof fetch, arch: NexusArch = c
const name = backendPackageName(match[1], arch);
const required = ['.tar.xz', '.manifest.json', '.sha512sum', '-source.tar.xz', '-source.sha512sum'];
if (!required.every(suffix => item.assets?.some(asset => asset.name === name + suffix))) continue;
- if (!selected || compareVersions(match[1], selected.version) > 0)
- selected = { tag: item.tag_name!, version: match[1], repository, release: item };
+ if (!selected || compareVersions(match[1], selected.version) > 0) {
+ const aliases: readonly BackendRepository[] = repository === BACKEND_REPOSITORY ? [BACKEND_REPOSITORY] : LEGACY_BACKEND_REPOSITORIES;
+ const actualRepository = aliases.find(repo => required.every(suffix => {
+ const assets = item.assets!.filter(asset => asset.name === name + suffix);
+ return assets.length === 1 && assets[0].browser_download_url === `https://github.com/${repo}/releases/download/${item.tag_name}/${name}${suffix}`;
+ }));
+ if (!actualRepository) throw Error('Unexpected backend release asset URL.');
+ selected = { tag: item.tag_name!, version: match[1], repository: actualRepository, release: item };
+ }
}
}
if (!selected) throw new Error('No compatible Nexus backend release has been published yet.');
diff --git a/src/main/diagnostic-report.ts b/src/main/diagnostic-report.ts
index 7ad81f0..1d428cc 100644
--- a/src/main/diagnostic-report.ts
+++ b/src/main/diagnostic-report.ts
@@ -109,7 +109,7 @@ export async function createDiagnosticReport(input: {
privateValues?: string[];
}): Promise<DiagnosticReport> {
const { snapshot: data } = input;
- const lines = ['Xodus Nexus diagnostic report', `Created: ${new Date().toISOString()}`,
+ const lines = ['Nexus Launcher diagnostic report', `Created: ${new Date().toISOString()}`,
'Automatic redaction is best effort. Review this report before sharing.',
'Logs are bounded snapshots, not complete files. Prefixes, game files and saves are not read.',
'', '## Versions', `Launcher: ${clean(input.launcherVersion)}`,
diff --git a/src/main/game-shortcuts.test.ts b/src/main/game-shortcuts.test.ts
index 7132730..e5acca0 100644
--- a/src/main/game-shortcuts.test.ts
+++ b/src/main/game-shortcuts.test.ts
@@ -51,7 +51,7 @@ it('writes safe persistent desktop descriptors for live Steam imports without to
expect((await fs.stat(prepared.file)).mode & 0o777).toBe(0o600);
await expect(fs.access(f.locations.applications)).rejects.toThrow();
const nexus = await f.shortcuts.steamDesktop();
- expect(await fs.readFile(nexus.file, 'utf8')).toContain('Name=Xodus Nexus\n');
+ expect(await fs.readFile(nexus.file, 'utf8')).toContain('Name=Nexus Launcher\n');
await fs.writeFile(prepared.file, 'unrelated user file');
await expect(f.shortcuts.steamDesktop(game)).rejects.toThrow('unrelated');
expect(await fs.readFile(prepared.file, 'utf8')).toBe('unrelated user file');
diff --git a/src/main/game-shortcuts.ts b/src/main/game-shortcuts.ts
index 21ba259..297e8bb 100644
--- a/src/main/game-shortcuts.ts
+++ b/src/main/game-shortcuts.ts
@@ -205,7 +205,7 @@ export class GameShortcuts {
const file = path.join(directory, `${game?.id ?? 'launcher'}.desktop`);
const identity = `X-Xodus-Nexus-Steam=${game?.id ?? 'launcher'}`;
const entry = game ? this.entry! : this.nexusEntry!;
- const body = `[Desktop Entry]\nType=Application\nName=${desktopValue(launch.title)}\nExec=/bin/sh ${desktopArgument(entry)}${game ? ' ' + desktopArgument(game.id) : ''}\nPath=${desktopValue(launch.directory)}\nIcon=${desktopValue(launch.icon)}\nTerminal=false\nCategories=Game;\n${this.marker}\n${identity}\n`;
+ const body = `[Desktop Entry]\nType=Application\nName=${desktopValue(game ? launch.title : 'Nexus Launcher')}\nExec=/bin/sh ${desktopArgument(entry)}${game ? ' ' + desktopArgument(game.id) : ''}\nPath=${desktopValue(launch.directory)}\nIcon=${desktopValue(launch.icon)}\nTerminal=false\nCategories=Game;\n${this.marker}\n${identity}\n`;
await this.write(file, body, 0o600, [this.marker, identity]);
return { launch, file };
}
@@ -220,7 +220,7 @@ export class GameShortcuts {
const title = game.title.replace(/[\0\r\n\t]/g, ' ').trim() || 'Xodus Nexus game';
// Keep the executable field constant: desktop loaders may check it before
// expanding %% in arguments. /bin/sh runs a file, never a shell -c string.
- const body = `[Desktop Entry]\nType=Application\nVersion=1.0\nName=${desktopValue(title)}\nComment=Play with Xodus Nexus\nExec=/bin/sh ${desktopArgument(this.entry)} ${desktopArgument(game.id)}\nIcon=${desktopValue(icon)}\nTerminal=false\nCategories=Game;\nStartupNotify=false\n${this.marker}\n${this.gameMarker(game.id)}\n`;
+ const body = `[Desktop Entry]\nType=Application\nVersion=1.0\nName=${desktopValue(title)}\nComment=Play with Nexus Launcher\nExec=/bin/sh ${desktopArgument(this.entry)} ${desktopArgument(game.id)}\nIcon=${desktopValue(icon)}\nTerminal=false\nCategories=Game;\nStartupNotify=false\n${this.marker}\n${this.gameMarker(game.id)}\n`;
const target = await this.writeEntry(directory, shortcutTitleStem(title), game.id, body, destination === 'desktop' ? 0o755 : 0o644);
// Migrate only this game's managed entries, after the replacement is safe.
const windowEntry = path.join(this.locations.applications, `xodus-nexus-game-${this.profileId}-${game.id}.desktop`);
diff --git a/src/main/index.ts b/src/main/index.ts
index c01c1a1..39e21b0 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -18,6 +18,7 @@ import type { AppSnapshot, AuthStatus, ConnectivityStatus, DownloadTask, Game, O
import { downloadFailure, safeProductId } from '../shared/utils.js';
import { contentLicenseFailure } from '../shared/content-license.js';
import { interfaceLanguagePreference } from '../shared/interface-language.js';
+import {preserveLauncherIdentity,launcherDisplayName} from './launcher-identity.js';
import { nativeTranslator } from './interface-language.js';
import { downloadLimitArgs, downloadLimitKiB } from '../shared/download-bandwidth.js';
import { DownloadBandwidthControls, isBandwidthOnlyPatch } from './download-bandwidth.js';
@@ -216,7 +217,7 @@ const launcherTray=new LauncherTray(()=>{
const open=async(page?:'home'|'library'|'store'|'settings')=>{await showLauncher();if(page)mainWindow?.webContents.send('launcher-page',page);};
const navigate=(page:'home'|'library'|'store'|'settings')=>()=>{void open(page).catch(()=>console.error('Could not restore Nexus.'));};
try{
- tray.setToolTip('Xodus Nexus');tray.on('click',navigate('home'));
+ tray.setToolTip(launcherDisplayName);tray.on('click',navigate('home'));
tray.setContextMenu(Menu.buildFromTemplate([
{label:nativeText('Home'),click:navigate('home')},{label:nativeText('My Library'),click:navigate('library')},
{label:nativeText('Store'),click:navigate('store')},{label:nativeText('Settings'),click:navigate('settings')},
@@ -276,8 +277,8 @@ let startupRequest: ReturnType<typeof shortcutArguments> = {};
let startupError: Error | undefined;
try {
startupRequest = shortcutArguments(process.argv.slice(1));
- if (startupRequest.profile) app.setPath('userData', startupRequest.profile);
-} catch (error) { startupError = error as Error; }
+ preserveLauncherIdentity(app,startupRequest.profile);
+} catch (error) { startupError = error as Error; preserveLauncherIdentity(app); }
if (process.platform === 'linux') {
try {
const fonts = adoptLauncherFonts();
@@ -1677,7 +1678,7 @@ function registerDemoIpc(catalogMarket: () => string): void {
ipcMain.handle('copy-diagnostic-log', () => clipboard.writeText('Demo diagnostic log. No account data.'));
ipcMain.handle('reveal-diagnostic-log', () => undefined);
ipcMain.handle('read-backend-diagnostic-log', () => ({ name: 'backend.log', content: 'Sample backend diagnostics. No account data.', truncated: false }));
- ipcMain.handle('create-diagnostic-report', () => ({ name: 'nexus-diagnostics-demo.txt', content: 'Xodus Nexus diagnostic report\nDemo data only.\nLauncher: ' + app.getVersion() }));
+ ipcMain.handle('create-diagnostic-report', () => ({ name: 'nexus-diagnostics-demo.txt', content: 'Nexus Launcher diagnostic report\nDemo data only.\nLauncher: ' + app.getVersion() }));
ipcMain.handle('save-diagnostic-report', (_event, content: unknown) => saveReviewedReport(content));
ipcMain.handle('login', () => {});
ipcMain.handle('logout', () => {});
@@ -2371,7 +2372,7 @@ async function createWindow(): Promise<void> {
minWidth: Math.min(800, area.width),
minHeight: Math.min(600, area.height),
backgroundColor: '#080a0c',
- title: 'Xodus Nexus',
+ title: launcherDisplayName,
icon: fileURLToPath(new URL('../../assets/icon.png', import.meta.url)),
autoHideMenuBar: true,
show: !hiddenCapture,
diff --git a/src/main/keyring-session.ts b/src/main/keyring-session.ts
index 67cef36..b7c1498 100644
--- a/src/main/keyring-session.ts
+++ b/src/main/keyring-session.ts
@@ -89,7 +89,7 @@ export async function startSessionKeyring(provider: KdeProvider, source: NodeJS.
stopProperties.push(`--property=ExecStop=${command} \${MAINPID}`, '--property=TimeoutStopSec=12s');
}
const args = ['--user', '--collect', '--service-type=exec', '--expand-environment=no', '--quiet',
- '--description=Xodus Nexus session wallet',
+ '--description=Nexus Launcher session wallet',
`--unit=xodus-nexus-keyring-${randomUUID()}`, '--property=PartOf=graphical-session.target',
'--property=StandardOutput=null', '--property=StandardError=null', ...stopProperties, '--',
'/usr/bin/env', '-i', 'PATH=/usr/bin:/bin', ...assignments, binary];
diff --git a/src/main/launcher-identity.test.ts b/src/main/launcher-identity.test.ts
new file mode 100644
index 0000000..cbe0920
--- /dev/null
+++ b/src/main/launcher-identity.test.ts
@@ -0,0 +1,31 @@
+import {expect,it,vi} from 'vitest';
+import {promises as fs} from 'node:fs';
+import path from 'node:path';
+import os from 'node:os';
+import {legacyLauncherProfile,preserveLauncherIdentity} from './launcher-identity';
+import {StateStore} from './store';
+
+it('pins the observed legacy dev and packaged Electron profile while preserving explicit profiles',()=>{
+ const data='/isolated/config',legacy=data+'/xodus-nexus';
+ expect(legacyLauncherProfile(data,legacy,'xodus-nexus')).toBe(legacy);
+ expect(legacyLauncherProfile(data,data+'/Nexus Launcher','Nexus Launcher')).toBe(legacy);
+ const explicit='/isolated/custom profile/../chosen';expect(legacyLauncherProfile(data,data+'/Nexus Launcher','Nexus Launcher',explicit)).toBe(explicit);
+ expect(legacyLauncherProfile(data,'/isolated/demo-profile','Electron')).toBe('/isolated/demo-profile');
+ let selected=data+'/Nexus Launcher';const events:string[]=[];
+ const app={getPath:(name:string)=>name==='appData'?data:selected,getName:()=> 'Nexus Launcher',setPath:(_name:string,value:string)=>{selected=value;events.push('profile');},setDesktopName:vi.fn(),commandLine:{appendSwitch:vi.fn()}};
+ preserveLauncherIdentity(app,undefined,'linux');events.push('lock:'+selected);
+ expect(events).toEqual(['profile','lock:'+legacy]);expect(app.setDesktopName).toHaveBeenCalledWith('org.xodusgaming.nexus.desktop');
+});
+it('loads old settings and games without moving or rewriting profile/runtime/save state',async()=>{
+ const root=await fs.mkdtemp(path.join(os.tmpdir(),'nexus-rename-profile-'));
+ try{
+ const config=root+'/config',profile=config+'/xodus-nexus',runtime=root+'/data/xodus-nexus/runtimes',game=root+'/Games/Xodus Nexus/Existing';
+ await fs.mkdir(profile,{recursive:true});await fs.mkdir(runtime,{recursive:true});await fs.mkdir(game,{recursive:true});
+ const state=JSON.stringify({settings:{installRoot:root+'/Games/Xodus Nexus',runtimeRoot:runtime,multiAccountEnabled:true},games:[{id:'0123456789abcdef',title:'Existing',path:game,addedAt:'2026-11-01T00:00:00Z'}],downloads:[]});
+ await fs.writeFile(profile+'/launcher-state.json',state);await fs.writeFile(runtime+'/current.json','existing runtime');await fs.writeFile(game+'/save.dat','existing save');
+ const selected=legacyLauncherProfile(config,config+'/Nexus Launcher','Nexus Launcher');const store=new StateStore(selected);await store.load();
+ expect(store.games[0].path).toBe(game);expect(store.settings.runtimeRoot).toBe(runtime);expect(store.settings.multiAccountEnabled).toBe(true);
+ expect(await fs.readFile(profile+'/launcher-state.json','utf8')).toBe(state);expect(await fs.readFile(runtime+'/current.json','utf8')).toBe('existing runtime');expect(await fs.readFile(game+'/save.dat','utf8')).toBe('existing save');
+ await expect(fs.stat(config+'/Nexus Launcher')).rejects.toThrow();
+ }finally{await fs.rm(root,{recursive:true,force:true});}
+});
diff --git a/src/main/launcher-identity.ts b/src/main/launcher-identity.ts
new file mode 100644
index 0000000..16ba271
--- /dev/null
+++ b/src/main/launcher-identity.ts
@@ -0,0 +1,26 @@
+import path from 'node:path';
+
+export const launcherDisplayName='Nexus Launcher';
+export const launcherIdentity='xodus-nexus';
+export const launcherDesktopId='org.xodusgaming.nexus.desktop';
+
+/** Electron 44 uses package.productName || package.name in both startup modes. */
+export function legacyLauncherProfile(appData:string,current:string,currentName:string,profile?:string):string {
+ if(profile!==undefined)return profile;
+ const legacy=path.join(appData,launcherIdentity);
+ // Preserve an explicitly supplied profile, including private demo harnesses.
+ return current===path.join(appData,currentName)||current===legacy?legacy:current;
+}
+interface Application {
+ getPath(name:'appData'|'userData'):string;
+ getName?:()=>string;
+ setPath(name:'userData',value:string):void;
+ setDesktopName?:(name:string)=>void;
+}
+/** Called before app readiness and the profile-scoped single-instance lock. */
+export function preserveLauncherIdentity(app:Application,profile?:string,platform=process.platform):void {
+ app.setPath('userData',legacyLauncherProfile(app.getPath('appData'),app.getPath('userData'),app.getName?.()??launcherIdentity,profile));
+ if(platform==='linux'){
+ app.setDesktopName?.(launcherDesktopId);
+ }
+}
diff --git a/src/main/launcher-update.test.ts b/src/main/launcher-update.test.ts
index 83c2c18..5fe1c29 100644
--- a/src/main/launcher-update.test.ts
+++ b/src/main/launcher-update.test.ts
@@ -11,18 +11,18 @@ function image(marker: number, arch: NexusArch = currentArch()): Buffer {
const bytes = Buffer.alloc(100, marker); Buffer.from('7f454c46', 'hex').copy(bytes);
bytes[4] = 2; bytes[5] = 1; Buffer.from('414902', 'hex').copy(bytes, 8); bytes.writeUInt16LE(ELF_MACHINE[arch], 18); return bytes;
}
-function release(version = '0.2.3', arch: NexusArch = currentArch()) {
- const name = `Xodus-Nexus-${version}-${APPIMAGE_ARCH_SUFFIX[arch]}.AppImage`;
+function release(version = '0.2.3', arch: NexusArch = currentArch(), repo='domsvoboda/xodus-nexus',family='Xodus-Nexus') {
+ const name = `${family}-${version}-${APPIMAGE_ARCH_SUFFIX[arch]}.AppImage`;
return { tag_name: `v${version}`, assets: [
- { name, size: 100, browser_download_url: `https://github.com/domsvoboda/xodus-nexus/releases/download/v${version}/${name}` },
- { name: `${name}.sha512sum`, size: 200, browser_download_url: `https://github.com/domsvoboda/xodus-nexus/releases/download/v${version}/${name}.sha512sum` },
+ { name, size: 100, browser_download_url: `https://github.com/${repo}/releases/download/v${version}/${name}` },
+ { name: `${name}.sha512sum`, size: 200, browser_download_url: `https://github.com/${repo}/releases/download/v${version}/${name}.sha512sum` },
] };
}
-async function fixture(bad = '', arch: NexusArch = currentArch()) {
+async function fixture(bad = '', arch: NexusArch = currentArch(),repo='domsvoboda/xodus-nexus',family='Xodus-Nexus') {
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'nexus-update-test-')); roots.push(root);
const target = path.join(root, 'Launcher.AppImage'); await fs.writeFile(target, image(1,arch), { mode: 0o700 });
const next = bad === 'format' ? Buffer.alloc(100) : image(2,bad==='architecture'?(arch==='x64'?'arm64':'x64'):arch);
- const r = release('0.2.3',arch);
+ const r = release('0.2.3',arch,repo,family);
const fetcher = (async (url: string | URL | Request) => {
const text = String(url);
if (text.includes('api.github')) return new Response(JSON.stringify([r]));
@@ -69,3 +69,27 @@ describe('AppImage updater', () => {
const dev = new LauncherUpdater('0.2.2', undefined, root, () => {}, fetcher); await dev.initialize(); expect(dev.state.canInstall).toBe(false);
});
});
+
+it.each(['domsvoboda/xodus-nexus','domsvoboda/nexus-launcher'])('accepts coherent old/new artifact families only under the exact %s release',repo=>{
+ for(const family of ['Xodus-Nexus','Nexus-Launcher'])for(const arch of ['x64','arm64'] as const){
+ const r=release('0.5.0',arch,repo,family),candidate=launcherCandidate([r],'0.4.2',arch);
+ expect(candidate?.image.name).toBe(`${family}-0.5.0-${APPIMAGE_ARCH_SUFFIX[arch]}.AppImage`);expect(candidate?.releaseUrl).toBe(`https://github.com/${repo}/releases/tag/v0.5.0`);
+ }
+});
+it('rejects cross-repository/tag/family/checksum links, traversal and downgraded releases',()=>{
+ for(const url of ['https://evil.example/update','https://github.com/attacker/nexus-launcher/releases/download/v0.5.0/Xodus-Nexus-0.5.0-x86_64.AppImage','https://github.com/domsvoboda/nexus-launcher/releases/download/v0.5.0/Xodus-Nexus-0.5.0-x86_64.AppImage','https://github.com/domsvoboda/xodus-nexus/releases/download/v0.5.0/../Xodus-Nexus-0.5.0-x86_64.AppImage']){
+ const r=release('0.5.0','x64');r.assets[0].browser_download_url=url;expect(launcherCandidate([r],'0.4.2','x64')).toBeUndefined();
+ }
+ for(const change of ['tag','family','duplicate']){
+ const r=release('0.5.0','x64');
+ if(change==='tag')r.assets[1].browser_download_url=r.assets[1].browser_download_url.replace('v0.5.0','v0.5.1');
+ if(change==='family')r.assets[1].name=r.assets[1].name.replace('Xodus-Nexus','Nexus-Launcher');
+ if(change==='duplicate')r.assets.push({...r.assets[1]});
+ expect(launcherCandidate([r],'0.4.2','x64')).toBeUndefined();
+ }
+ expect(launcherCandidate([release('0.4.1')],'0.4.2')).toBeUndefined();
+});
+it('installs verified renamed-repository bytes in the existing AppImage path without moving state',async()=>{
+ const {root,target,updater}=await fixture('',currentArch(),'domsvoboda/nexus-launcher','Nexus-Launcher');
+ await fs.writeFile(root+'/launcher-state.json','old state');await updater.install();expect(await fs.readFile(target)).toEqual(image(2));expect(await fs.readFile(root+'/launcher-state.json','utf8')).toBe('old state');
+});
diff --git a/src/main/launcher-update.ts b/src/main/launcher-update.ts
index be47a34..2aaa11a 100644
--- a/src/main/launcher-update.ts
+++ b/src/main/launcher-update.ts
@@ -11,22 +11,25 @@ interface Asset { name: string; browser_download_url: string; size: number }
interface Release { tag_name: string; draft?: boolean; prerelease?: boolean; assets: Asset[] }
export interface LauncherCandidate { version: string; image: Asset; checksum: Asset; releaseUrl: string }
-function assetUrl(url: string, tag: string, name: string): boolean {
- return url === `https://github.com/${REPO}/releases/download/${tag}/${name}`;
-}
+const REPOSITORIES=['domsvoboda/xodus-nexus','domsvoboda/nexus-launcher'] as const;
+const ARTIFACT_FAMILIES=['Xodus-Nexus','Nexus-Launcher'] as const;
export function launcherCandidate(releases: Release[], current: string, arch: NexusArch = currentArch()): LauncherCandidate | undefined {
- const stable = releases.filter(r => !r.draft && !r.prerelease && /^v\d+\.\d+\.\d+$/.test(r.tag_name));
+ const stable = releases.filter(r => !r.draft && !r.prerelease && typeof r.tag_name === 'string' && /^v\d+\.\d+\.\d+$/.test(r.tag_name));
stable.sort((a, b) => isNewerVersion(a.tag_name, b.tag_name) ? -1 : isNewerVersion(b.tag_name, a.tag_name) ? 1 : 0);
for (const r of stable) {
if (!isNewerVersion(r.tag_name, current)) continue;
- const name = `Xodus-Nexus-${r.tag_name.slice(1)}-${APPIMAGE_ARCH_SUFFIX[arch]}.AppImage`;
- const image = r.assets?.find(a => a.name === name);
- const checksum = r.assets?.find(a => a.name === `${name}.sha512sum`);
- if (!image || !checksum || !assetUrl(image.browser_download_url, r.tag_name, image.name) ||
- !assetUrl(checksum.browser_download_url, r.tag_name, checksum.name) ||
- !Number.isSafeInteger(image.size) || image.size < 64 || image.size > 1024 ** 3 ||
- !Number.isSafeInteger(checksum.size) || checksum.size < 1 || checksum.size > 4096) continue;
- return { version: r.tag_name.slice(1), image, checksum, releaseUrl: `https://github.com/${REPO}/releases/tag/${r.tag_name}` };
+ for (const family of ARTIFACT_FAMILIES) {
+ const name = `${family}-${r.tag_name.slice(1)}-${APPIMAGE_ARCH_SUFFIX[arch]}.AppImage`;
+ const images = Array.isArray(r.assets) ? r.assets.filter(a => a.name === name) : [];
+ const sums = Array.isArray(r.assets) ? r.assets.filter(a => a.name === `${name}.sha512sum`) : [];
+ if (images.length !== 1 || sums.length !== 1) continue;
+ const image = images[0], checksum = sums[0];
+ const repository = REPOSITORIES.find(repo => image.browser_download_url === `https://github.com/${repo}/releases/download/${r.tag_name}/${name}`
+ && checksum.browser_download_url === `https://github.com/${repo}/releases/download/${r.tag_name}/${name}.sha512sum`);
+ if (!repository || !Number.isSafeInteger(image.size) || image.size < 64 || image.size > 1024 ** 3
+ || !Number.isSafeInteger(checksum.size) || checksum.size < 1 || checksum.size > 4096) continue;
+ return { version: r.tag_name.slice(1), image, checksum, releaseUrl: `https://github.com/${repository}/releases/tag/${r.tag_name}` };
+ }
}
return undefined;
}
diff --git a/src/main/proton-layout.ts b/src/main/proton-layout.ts
index 0549bad..2fe74b8 100644
--- a/src/main/proton-layout.ts
+++ b/src/main/proton-layout.ts
@@ -30,7 +30,7 @@ export function protonRootOf(winePath: string): string {
export function runtimeArchiveArch(arch: string = process.arch): 'x86_64' | 'aarch64' {
if (arch === 'x64') return 'x86_64';
if (arch === 'arm64') return 'aarch64';
- throw new Error(`Xodus Nexus runtimes are not built for ${arch} hosts.`);
+ throw new Error(`Nexus Launcher runtimes are not built for ${arch} hosts.`);
}
/**
diff --git a/src/main/xbox-overlay-shortcut.ts b/src/main/xbox-overlay-shortcut.ts
index 465c67f..2898704 100644
--- a/src/main/xbox-overlay-shortcut.ts
+++ b/src/main/xbox-overlay-shortcut.ts
@@ -15,7 +15,7 @@ export async function ensureOverlayDesktopEntry(appImage:string,dataRoot=process
await fs.mkdir(directory,{recursive:true});const temporary=await fs.mkdtemp(path.join(directory,'.nexus-guide-'));
try{
const entry=path.join(temporary,'entry.desktop');
- await fs.writeFile(entry,`[Desktop Entry]\nType=Application\nName=Xodus Nexus\nExec="${quoted}" %U\nNoDisplay=true\nStartupWMClass=org.xodusgaming.nexus\nX-Nexus-Managed=true\n`,{mode:0o600,flag:'wx'});await fs.rename(entry,file);
+ await fs.writeFile(entry,`[Desktop Entry]\nType=Application\nName=Nexus Launcher\nExec="${quoted}" %U\nNoDisplay=true\nStartupWMClass=org.xodusgaming.nexus\nX-Nexus-Managed=true\n`,{mode:0o600,flag:'wx'});await fs.rename(entry,file);
}finally{await fs.rm(temporary,{recursive:true,force:true});}
}
export class XboxOverlayShortcut {