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 = [
{
label: PRODUCT_NAME,
value: versionInfo.isAUR
? `${versionInfo.appVersion} (AUR)`
value: versionInfo.aurPackageVersion
? (() => {
const pkgrel = versionInfo.aurPackageVersion.split('-')[1];
return pkgrel && pkgrel !== '1'
? `${versionInfo.appVersion} (AUR r${pkgrel})`
: versionInfo.appVersion;
})()
: versionInfo.appVersion,
},
{ label: 'Electron', value: versionInfo.electronVersion },

View file

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

View file

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

View file

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

View file

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