start displaying the AUR build number in "About" app info

This commit is contained in:
Egor 2025-09-24 10:53:22 -07:00
parent d6d3dd53df
commit 1636eef4ec
5 changed files with 32 additions and 24 deletions

View file

@ -43,8 +43,13 @@ export const AboutTab = () => {
const versionItems = [ const versionItems = [
{ {
label: PRODUCT_NAME, label: PRODUCT_NAME,
value: versionInfo.isAUR value: versionInfo.aurPackageVersion
? `${versionInfo.appVersion} (AUR)` ? (() => {
const pkgrel = versionInfo.aurPackageVersion.split('-')[1];
return pkgrel && pkgrel !== '1'
? `${versionInfo.appVersion} (AUR r${pkgrel})`
: versionInfo.appVersion;
})()
: versionInfo.appVersion, : versionInfo.appVersion,
}, },
{ label: 'Electron', value: versionInfo.electronVersion }, { label: 'Electron', value: versionInfo.electronVersion },

View file

@ -40,7 +40,7 @@ import {
isNpxAvailable, isNpxAvailable,
getUvVersion, getUvVersion,
getSystemNodeVersion, getSystemNodeVersion,
isAURInstallation, getAURVersion,
} from '@/main/modules/dependencies'; } from '@/main/modules/dependencies';
import { getMainWindow } from '@/main/modules/window'; import { getMainWindow } from '@/main/modules/window';
import { import {
@ -160,12 +160,12 @@ export function setupIPCHandlers() {
ipcMain.handle('app:getVersion', () => getAppVersion()); ipcMain.handle('app:getVersion', () => getAppVersion());
ipcMain.handle('app:getVersionInfo', async () => { ipcMain.handle('app:getVersionInfo', async () => {
const [appVersion, nodeJsSystemVersion, uvVersion, isAUR] = const [appVersion, nodeJsSystemVersion, uvVersion, aurPackageVersion] =
await Promise.all([ await Promise.all([
getAppVersion(), getAppVersion(),
getSystemNodeVersion(), getSystemNodeVersion(),
getUvVersion(), getUvVersion(),
isAURInstallation(), getAURVersion(),
]); ]);
return { return {
@ -179,7 +179,7 @@ export function setupIPCHandlers() {
arch, arch,
nodeJsSystemVersion, nodeJsSystemVersion,
uvVersion, uvVersion,
isAUR, aurPackageVersion,
}; };
}); });
@ -276,7 +276,10 @@ export function setupIPCHandlers() {
ipcMain.handle('app:canAutoUpdate', () => canAutoUpdate()); ipcMain.handle('app:canAutoUpdate', () => canAutoUpdate());
ipcMain.handle('app:isAURInstallation', () => isAURInstallation()); ipcMain.handle('app:isAURInstallation', async () => {
const aurPackageVersion = await getAURVersion();
return aurPackageVersion !== null;
});
ipcMain.handle( ipcMain.handle(
'notepad:saveTabContent', 'notepad:saveTabContent',

View file

@ -3,10 +3,7 @@ import { app } from 'electron';
import { platform } from 'process'; import { platform } from 'process';
import { logError, safeExecute } from '@/utils/node/logging'; import { logError, safeExecute } from '@/utils/node/logging';
import { isDevelopment } from '@/utils/node/environment'; import { isDevelopment } from '@/utils/node/environment';
import { import { getAURVersion, isWindowsPortableInstallation } from './dependencies';
isAURInstallation,
isWindowsPortableInstallation,
} from './dependencies';
export interface UpdateInfo { export interface UpdateInfo {
version: string; version: string;
@ -78,7 +75,7 @@ export const isUpdateDownloaded = () => updateDownloaded;
export const canAutoUpdate = async () => { export const canAutoUpdate = async () => {
if (!app.isPackaged) return false; if (!app.isPackaged) return false;
if (platform === 'linux' && (await isAURInstallation())) { if (platform === 'linux' && (await getAURVersion()) !== null) {
return false; return false;
} }

View file

@ -154,15 +154,15 @@ async function tryVersionManagerPath(
return false; return false;
} }
let aurInstallationCache: boolean | null = null; let aurVersionCache: string | null = null;
export async function isAURInstallation() { export async function getAURVersion() {
if (platform !== 'linux') { if (platform !== 'linux') {
return false; return null;
} }
if (aurInstallationCache !== null) { if (aurVersionCache !== null) {
return aurInstallationCache; return aurVersionCache;
} }
try { try {
@ -170,12 +170,15 @@ export async function isAURInstallation() {
timeout: 1000, timeout: 1000,
reject: false, reject: false,
}); });
aurInstallationCache = stdout.trim().length > 0; const trimmed = stdout.trim();
return aurInstallationCache; if (trimmed.length > 0) {
} catch { aurVersionCache = trimmed.replace('gerbil ', '');
aurInstallationCache = false; return aurVersionCache;
return false;
} }
} catch {}
aurVersionCache = null;
return null;
} }
function tryAddPathToEnv( function tryAddPathToEnv(

View file

@ -147,7 +147,7 @@ export interface VersionInfo {
arch: string; arch: string;
nodeJsSystemVersion?: string; nodeJsSystemVersion?: string;
uvVersion?: string; uvVersion?: string;
isAUR?: boolean; aurPackageVersion?: string;
} }
export interface AppAPI { export interface AppAPI {