- Add backend auto-start functionality in main process - Fix authentication token storage for Electron environment - Implement localStorage-based token management in Electron - Add proper Electron environment detection via preload script - Fix WebSocket connections for terminal functionality - Resolve font file loading issues in packaged application - Update API endpoints to work with backend auto-start - Streamline build scripts with unified electron:package command - Fix better-sqlite3 native module compatibility issues - Ensure all services start automatically in production mode 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
614 B
JavaScript
18 lines
614 B
JavaScript
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
// 暴露简化的 API 给渲染进程
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
// 获取应用版本
|
|
getAppVersion: () => ipcRenderer.invoke('get-app-version'),
|
|
|
|
// 获取平台信息
|
|
getPlatform: () => ipcRenderer.invoke('get-platform'),
|
|
|
|
// 环境检测
|
|
isElectron: true,
|
|
isDev: process.env.NODE_ENV === 'development',
|
|
});
|
|
|
|
// 添加一个标识,让渲染进程知道这是 Electron 环境
|
|
// 在上下文隔离环境中,使用 contextBridge 暴露
|
|
contextBridge.exposeInMainWorld('IS_ELECTRON', true); |