2024-08-22 01:03:01 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 默认配置
|
|
|
|
|
|
*/
|
|
|
|
|
|
module.exports = (appInfo) => {
|
|
|
|
|
|
|
|
|
|
|
|
const config = {};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 开发者工具
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.openDevTools = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 应用程序顶部菜单
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.openAppMenu = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 主窗口
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.windowsOption = {
|
2024-08-22 01:33:32 +00:00
|
|
|
|
title: 'book',
|
|
|
|
|
|
width: 1920,
|
2024-08-22 08:50:01 +00:00
|
|
|
|
height: 1200,
|
2024-08-22 01:33:32 +00:00
|
|
|
|
minWidth: 1920,
|
2024-08-22 08:50:01 +00:00
|
|
|
|
minHeight: 1200,
|
2024-08-22 01:33:32 +00:00
|
|
|
|
|
|
|
|
|
|
frame: false,
|
|
|
|
|
|
fullscreenable: true,
|
|
|
|
|
|
fullscreen: true,
|
|
|
|
|
|
simpleFullscreen: true,
|
|
|
|
|
|
// // 禁止缩小
|
|
|
|
|
|
// resizable: false,
|
|
|
|
|
|
// // 禁止最小化
|
|
|
|
|
|
// minimizable: false,
|
2024-08-22 01:03:01 +00:00
|
|
|
|
webPreferences: {
|
|
|
|
|
|
//webSecurity: false,
|
|
|
|
|
|
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
|
|
|
|
|
nodeIntegration: true,
|
|
|
|
|
|
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
|
|
|
|
|
|
},
|
2024-08-22 01:33:32 +00:00
|
|
|
|
show: true,
|
2024-08-22 01:03:01 +00:00
|
|
|
|
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: 'appCtr.log',
|
|
|
|
|
|
coreLogName: 'appCtr-core.log',
|
|
|
|
|
|
errorLogName: 'appCtr-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"],
|
|
|
|
|
|
cors: {
|
|
|
|
|
|
origin: true,
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 内置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'
|
|
|
|
|
|
],
|
|
|
|
|
|
returnData: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 主进程
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.mainServer = {
|
|
|
|
|
|
protocol: 'file://',
|
|
|
|
|
|
indexPath: '/public/dist/index.html',
|
|
|
|
|
|
host: '127.0.0.1',
|
|
|
|
|
|
port: 7072,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Cross-language service
|
|
|
|
|
|
* 跨语言服务
|
|
|
|
|
|
* 例如:执行go的二进制程序,默认目录为 ./extraResources/
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.cross = {
|
|
|
|
|
|
go: {
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
name: 'goapp',
|
|
|
|
|
|
args: ['--port=7073'],
|
|
|
|
|
|
appExit: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
python: {
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
name: 'pyapp',
|
|
|
|
|
|
cmd: './py/pyapp',
|
|
|
|
|
|
directory: './py',
|
|
|
|
|
|
args: ['--port=7074'],
|
|
|
|
|
|
appExit: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 硬件加速
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.hardGpu = {
|
|
|
|
|
|
enable: true
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 异常捕获
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.exception = {
|
|
|
|
|
|
mainExit: false,
|
|
|
|
|
|
childExit: true,
|
|
|
|
|
|
rendererExit: true,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* jobs
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.jobs = {
|
|
|
|
|
|
messageLog: true
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 插件功能
|
|
|
|
|
|
*/
|
|
|
|
|
|
config.addons = {
|
|
|
|
|
|
window: {
|
|
|
|
|
|
enable: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
tray: {
|
|
|
|
|
|
enable: true,
|
|
|
|
|
|
title: 'appCtr',
|
|
|
|
|
|
icon: '/public/images/tray.png'
|
|
|
|
|
|
},
|
|
|
|
|
|
security: {
|
|
|
|
|
|
enable: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
awaken: {
|
|
|
|
|
|
enable: true,
|
|
|
|
|
|
protocol: 'appCtr',
|
|
|
|
|
|
args: []
|
|
|
|
|
|
},
|
|
|
|
|
|
autoUpdater: {
|
|
|
|
|
|
enable: true,
|
|
|
|
|
|
windows: false,
|
|
|
|
|
|
macOS: false,
|
|
|
|
|
|
linux: false,
|
|
|
|
|
|
options: {
|
|
|
|
|
|
provider: 'generic',
|
|
|
|
|
|
url: 'http://kodo.qiniu.com/'
|
|
|
|
|
|
},
|
|
|
|
|
|
force: false,
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
javaServer: {
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
port: 117680,
|
|
|
|
|
|
jreVersion: 'jre1.8.0_201',
|
|
|
|
|
|
opt: '-server -Xms512M -Xmx512M -Xss512k -Dspring.profiles.active=prod -Dserver.port=${port} -Dlogging.file.path="${path}" ',
|
|
|
|
|
|
name: 'java-app.jar'
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
...config
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|