mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
fix the --version handling regression for packaged builds
This commit is contained in:
parent
2c485ef37d
commit
83d5c9cbd4
3 changed files with 8 additions and 17 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gerbil",
|
"name": "gerbil",
|
||||||
"productName": "Gerbil",
|
"productName": "Gerbil",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"description": "Run Large Language Models locally",
|
"description": "Run Large Language Models locally",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ import {
|
||||||
} from '@/main/modules/binary';
|
} from '@/main/modules/binary';
|
||||||
import { startMonitoring, stopMonitoring } from '@/main/modules/monitoring';
|
import { startMonitoring, stopMonitoring } from '@/main/modules/monitoring';
|
||||||
import type { FrontendPreference } from '@/types';
|
import type { FrontendPreference } from '@/types';
|
||||||
|
import { getAppVersion } from '@/utils/node/fs';
|
||||||
|
|
||||||
async function launchKoboldCppWithCustomFrontends(args: string[] = []) {
|
async function launchKoboldCppWithCustomFrontends(args: string[] = []) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -152,10 +153,10 @@ export function setupIPCHandlers() {
|
||||||
|
|
||||||
ipcMain.handle('config:set', (_, key, value) => setConfig(key, value));
|
ipcMain.handle('config:set', (_, key, value) => setConfig(key, value));
|
||||||
|
|
||||||
ipcMain.handle('app:getVersion', () => app.getVersion());
|
ipcMain.handle('app:getVersion', () => getAppVersion());
|
||||||
|
|
||||||
ipcMain.handle('app:getVersionInfo', () => ({
|
ipcMain.handle('app:getVersionInfo', () => ({
|
||||||
appVersion: app.getVersion(),
|
appVersion: getAppVersion(),
|
||||||
electronVersion: process.versions.electron,
|
electronVersion: process.versions.electron,
|
||||||
nodeVersion: process.versions.node,
|
nodeVersion: process.versions.node,
|
||||||
chromeVersion: process.versions.chrome,
|
chromeVersion: process.versions.chrome,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { readFile, writeFile, access, mkdir } from 'fs/promises';
|
import { readFile, writeFile, access, mkdir } from 'fs/promises';
|
||||||
import { constants } from 'fs';
|
import { constants } from 'fs';
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
export const pathExists = async (path: string) => {
|
export const pathExists = async (path: string) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -11,9 +10,7 @@ export const pathExists = async (path: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const readJsonFile = async <T = unknown>(
|
export const readJsonFile = async <T = unknown>(path: string) => {
|
||||||
path: string
|
|
||||||
): Promise<T | null> => {
|
|
||||||
try {
|
try {
|
||||||
const content = await readFile(path, 'utf-8');
|
const content = await readFile(path, 'utf-8');
|
||||||
return JSON.parse(content) as T;
|
return JSON.parse(content) as T;
|
||||||
|
|
@ -37,14 +34,7 @@ export const ensureDir = async (path: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppVersion = async (): Promise<string> => {
|
export const getAppVersion = async () => {
|
||||||
try {
|
const { app } = await import('electron');
|
||||||
const packageJsonPath = join(__dirname, '../../../package.json');
|
return app.getVersion();
|
||||||
const packageJson = await readJsonFile<{ version: string }>(
|
|
||||||
packageJsonPath
|
|
||||||
);
|
|
||||||
return packageJson?.version || 'unknown';
|
|
||||||
} catch {
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue