2024-08-07 21:48:41 +08:00
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 默认配置
|
|
|
|
|
|
*/
|
|
|
|
|
|
module.exports = (appInfo) => {
|
|
|
|
|
|
|
|
|
|
|
|
const config = {};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 开发者工具
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.openDevTools = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 应用程序顶部菜单
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.openAppMenu = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 1.507
|
|
|
|
|
|
* 主窗口
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.windowsOption = {
|
|
|
|
|
|
title: '自动检测平台',
|
2025-10-10 15:29:54 +08:00
|
|
|
|
width: 1920 /1.5,
|
|
|
|
|
|
height: 1080 /1.2,
|
|
|
|
|
|
minWidth: 1920 /1.5,
|
|
|
|
|
|
minHeight: 1080 /1.2,
|
2024-08-07 21:48:41 +08:00
|
|
|
|
webPreferences: {
|
|
|
|
|
|
//webSecurity: false,
|
|
|
|
|
|
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要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: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 主进程
|
|
|
|
|
|
*/
|
|
|
|
|
|
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
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|