fix linux desktop packaging paths (#1162)
Co-authored-by: xingzhi <chuzihao.czh@alibaba-inc.com>
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 821 B |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
@@ -21,6 +21,10 @@ files:
|
||||
# Web UI source (built dist) and bundled Python live outside the asar.
|
||||
# This package lives at packages/desktop, so ../.. is the hermes-web-ui repo root.
|
||||
extraResources:
|
||||
- from: "build"
|
||||
to: "build"
|
||||
filter:
|
||||
- "icon.png"
|
||||
- from: "../.."
|
||||
to: "webui"
|
||||
filter:
|
||||
@@ -57,6 +61,7 @@ win:
|
||||
artifactName: "${productName}-${version}-${arch}.${ext}"
|
||||
|
||||
linux:
|
||||
icon: build/icons
|
||||
target:
|
||||
- target: AppImage
|
||||
arch: [x64, arm64]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { app, BrowserWindow, Menu, shell, ipcMain } from 'electron'
|
||||
import { join } from 'node:path'
|
||||
import { startWebUiServer, stopWebUiServer, getToken } from './webui-server'
|
||||
import { hermesBinExists, hermesBin } from './paths'
|
||||
import { desktopIcon, hermesBinExists, hermesBin } from './paths'
|
||||
import { initAutoUpdater } from './updater'
|
||||
|
||||
const PORT = Number(process.env.HERMES_DESKTOP_PORT) || 8748
|
||||
@@ -18,6 +18,7 @@ function createWindow() {
|
||||
title: 'Hermes Studio',
|
||||
backgroundColor: '#1a1a1a',
|
||||
autoHideMenuBar: true,
|
||||
...(process.platform === 'linux' ? { icon: desktopIcon() } : {}),
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '..', 'preload', 'index.js'),
|
||||
contextIsolation: true,
|
||||
|
||||
@@ -40,6 +40,11 @@ export function hermesBinExists(): boolean {
|
||||
return existsSync(hermesBin())
|
||||
}
|
||||
|
||||
export function desktopIcon(): string {
|
||||
if (app.isPackaged) return resolve(process.resourcesPath, 'build', 'icon.png')
|
||||
return resolve(app.getAppPath(), 'build', 'icon.png')
|
||||
}
|
||||
|
||||
export function webUiHome(): string {
|
||||
return process.env.HERMES_WEB_UI_HOME?.trim() || resolve(homedir(), '.hermes-web-ui')
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ export async function startWebUiServer(port = DEFAULT_PORT): Promise<string> {
|
||||
// macOS/Linux keep the standard ~/.hermes layout.
|
||||
HERMES_HOME: agentHome,
|
||||
HERMES_WEB_UI_HOME: home,
|
||||
HERMES_WEBUI_STATE_DIR: home,
|
||||
AUTH_TOKEN: token,
|
||||
PORT: String(port),
|
||||
// Prepend bundled Python's bin to PATH so any incidental `python` resolution lands on ours
|
||||
|
||||
@@ -14,6 +14,7 @@ import { homedir } from 'os'
|
||||
* - HERMES_WEBUI_STATE_DIR: Compatibility alias for HERMES_WEB_UI_HOME.
|
||||
* Default: join(homedir(), '.hermes-web-ui').
|
||||
* - UPLOAD_DIR: Upload directory override. Default: join(HERMES_WEB_UI_HOME, 'upload').
|
||||
* - dataDir: Internal Web UI runtime data directory. Default: join(HERMES_WEB_UI_HOME, 'data').
|
||||
*
|
||||
* Auth:
|
||||
* - AUTH_TOKEN: Explicit bearer token. If unset, Web UI stores an auto-generated token under HERMES_WEB_UI_HOME.
|
||||
@@ -41,6 +42,10 @@ export function getWebUiHome(env: Record<string, string | undefined> = process.e
|
||||
return appHome ? resolve(appHome) : join(homedir(), '.hermes-web-ui')
|
||||
}
|
||||
|
||||
export function getWebUiDataDir(env: Record<string, string | undefined> = process.env): string {
|
||||
return join(getWebUiHome(env), 'data')
|
||||
}
|
||||
|
||||
const appHome = getWebUiHome()
|
||||
|
||||
export const config = {
|
||||
@@ -49,6 +54,6 @@ export const config = {
|
||||
host: getListenHost(),
|
||||
appHome,
|
||||
uploadDir: process.env.UPLOAD_DIR || join(appHome, 'upload'),
|
||||
dataDir: resolve(__dirname, '..', 'data'),
|
||||
dataDir: getWebUiDataDir(),
|
||||
corsOrigins: process.env.CORS_ORIGINS || '*',
|
||||
}
|
||||
|
||||