升级electron egg脚手架版本

This commit is contained in:
2025-10-15 14:12:24 +08:00
parent ca8f173394
commit 081a77ac4c
54 changed files with 1756 additions and 1077 deletions

View File

@@ -1,185 +1,71 @@
'use strict';
const path = require('path');
const {getBaseDir} = require('ee-core/ps');
/**
* 默认配置
*/
module.exports = (appInfo) => {
const config = {};
/**
* 开发者工具
*/
config.openDevTools = false;
/**
* 应用程序顶部菜单
*/
config.openAppMenu = true;
/**
* 1.507
* 主窗口
*/
config.windowsOption = {
title: '自动检测平台',
width: 1920 /1.5,
height: 1080 /1.2,
minWidth: 1920 /1.5,
minHeight: 1080 /1.2,
webPreferences: {
//webSecurity: false,
contextIsolation: false, // false -> 可在渲染进程中使用electron的apitrue->需要bridge.js(contextBridge)
nodeIntegration: true,
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
},
frame: true,
show: false,
icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
};
/**
* ee框架日志
*/
config.logger = {
encoding: 'utf8',
level: 'INFO',
outputJSON: false,
buffer: true,
enablePerformanceTimer: false,
rotator: 'day',
appLogName: 'pqs9100.log',
coreLogName: 'pqs9100-core.log',
errorLogName: 'pqs9100-error.log'
}
/**
* 远程模式-web地址
*/
config.remoteUrl = {
enable: false,
url: 'http://electron-egg.kaka996.com/'
};
/**
* 内置socket服务
*/
config.socketServer = {
enable: false, // 是否开启
port: 7070,// 默认端口
path: "/socket.io/", // 默认路径名称
connectTimeout: 45000, // 客户端连接超时时间
pingTimeout: 30000, // 心跳检测超时时间
pingInterval: 25000, // 心跳检测间隔时间
maxHttpBufferSize: 1e8, // 每条消息的数据最大值
transports: ["polling", "websocket"], // http轮询和websocket
cors: {
origin: true, // http协议时需要设置允许跨域
},
channel: 'c1' // 默认频道c1可以自定义
};
/**
* 内置http服务
*/
config.httpServer = {
enable: false,
https: {
enable: false,
key: '/public/ssl/localhost+1.key',
cert: '/public/ssl/localhost+1.pem'
},
host: '127.0.0.1',
port: 7071,
cors: {
origin: "*" // 默认允许跨域
},
body: {
multipart: true,
formidable: {
keepExtensions: true
}
},
filterRequest: {
uris: [
'favicon.ico' // 默认过滤的uri favicon.ico
],
returnData: ''
module.exports = () => {
return {
openDevTools: false,
singleLock: true,
windowsOption: {
title: 'NPQS9100-自动检测平台',
menuBarVisible: false,
width: 1920,
height: 1000,
minWidth: 1024,
minHeight: 640,
webPreferences: {
//webSecurity: false,
contextIsolation: false, // false -> 可在渲染进程中使用electron的apitrue->需要bridge.js(contextBridge)
nodeIntegration: true,
//preload: path.join(getElectronDir(), 'preload', 'bridge.js'),
},
frame: true,
show: true,
icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
},
logger: {
level: 'INFO',
outputJSON: false,
appLogName: '9100.log',
coreLogName: '9100-core.log',
errorLogName: '9100-error.log'
},
// 远程web地址
remote: {
enable: false,
url: ''
},
socketServer: {
enable: false,
port: 7070,
path: "/socket.io/",
connectTimeout: 45000,
pingTimeout: 30000,
pingInterval: 25000,
maxHttpBufferSize: 1e8,
transports: ["polling", "websocket"],
cors: {
origin: true,
},
channel: 'socket-channel'
},
httpServer: {
enable: false,
https: {
enable: false,
key: '/public/ssl/localhost+1.key',
cert: '/public/ssl/localhost+1.pem'
},
host: '127.0.0.1',
port: 7071,
},
mainServer: {
indexPath: '/public/dist/index.html',
channelSeparator: '/',
}
}
};
/**
* 主进程
*/
config.mainServer = {
protocol: 'file://',
indexPath: '/public/dist/index.html',
};
/**
* 硬件加速
*/
config.hardGpu = {
enable: true
};
/**
* 异常捕获
*/
config.exception = {
mainExit: false, // 主进程退出时是否捕获异常
childExit: true,
rendererExit: true,
};
/**
* jobs
*/
config.jobs = {
messageLog: true // 是否打印进程间通信的消息log
};
/**
* 插件功能
* @param window 官方内置插件
* @param tray 托盘插件
* @param security 安全插件
* @param awaken 唤醒插件
* @param autoUpdater 自动升级插件
*/
config.addons = {
window: {
enable: true,
},
tray: {
enable: true,
title: '自动检测平台',
icon: '/public/images/tray.png'
},
security: {
enable: true,
},
awaken: {
enable: true,
protocol: 'ee',
args: []
},
autoUpdater: {
enable: true,
windows: false,
macOS: false,
linux: false,
options: {
provider: 'generic',
url: 'http://kodo.qiniu.com/'
},
force: false,
}
};
return {
...config
};
}