49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { join, dirname } from 'path'
|
|
import { name, version, debug } from '../../../package.json'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
|
|
export interface TrayOptions {
|
|
enabled: boolean
|
|
trayWindow: boolean
|
|
menu: boolean
|
|
tooltip: string
|
|
margin: { x: number; y: number }
|
|
showAtStartup: boolean
|
|
}
|
|
|
|
export default class Constants {
|
|
// Display app name (uppercase first letter)
|
|
static APP_NAME = '文案助手' //name.charAt(0).toUpperCase() + name.slice(1)
|
|
|
|
static APP_VERSION = version
|
|
|
|
static IS_DEV_ENV = process.env.NODE_ENV === 'development'
|
|
|
|
// To show devtools at startup. It requires IS_DEV_ENV=true.
|
|
// Note: For debugging purpose, window won't be closed if click elsewhere, if devtools is open.
|
|
static IS_DEVTOOLS = true
|
|
|
|
static IS_MAC = process.platform === 'darwin'
|
|
|
|
static DEFAULT_WEB_PREFERENCES = {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
enableRemoteModule: false,
|
|
preload: join(__dirname, '../preload/index.js')
|
|
}
|
|
|
|
static DEFAULT_TRAY_OPTIONS: TrayOptions = {
|
|
enabled: false,
|
|
trayWindow: false,
|
|
menu: false,
|
|
tooltip: 'Vutron App',
|
|
margin: { x: 0, y: 0 },
|
|
showAtStartup: false
|
|
}
|
|
|
|
static APP_INDEX_URL_DEV = `${debug.env.VITE_DEV_SERVER_URL}/index.html`
|
|
static APP_INDEX_URL_PROD = join(__dirname, '../index.html')
|
|
}
|