config.default.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. 'use strict';
  2. const dayjs = require('dayjs');
  3. const path = require('path');
  4. /**
  5. * 默认配置
  6. * @see https://www.yuque.com/u34495/mivcfg/guk1x0
  7. */
  8. module.exports = (appInfo) => {
  9. /**
  10. * built-in config
  11. * @type {Ee.EeAppConfig}
  12. **/
  13. const config = {};
  14. /* 应用模式配置 */
  15. config.developmentMode = {
  16. default: 'vue',
  17. mode: {
  18. vue: {
  19. hostname: 'localhost',
  20. port: 8080
  21. },
  22. react: {
  23. hostname: 'localhost',
  24. port: 3000
  25. },
  26. html: {
  27. hostname: 'localhost',
  28. indexPage: 'index.html'
  29. },
  30. }
  31. };
  32. /* 开发者工具 */
  33. config.openDevTools = false;
  34. /**
  35. * 应用程序顶部菜单
  36. * boolean | string
  37. * true, false, 'dev-show'(dev环境显示,prod环境隐藏)
  38. */
  39. config.openAppMenu = 'dev-show';
  40. /**
  41. * 主窗口
  42. */
  43. config.windowsOption = {
  44. width: 980,
  45. height: 650,
  46. minWidth: 800,
  47. minHeight: 650,
  48. webPreferences: {
  49. //webSecurity: false,
  50. contextIsolation: false, // false->可在渲染进程中使用electronApi,true->需要bridge.js(contextBridge)
  51. nodeIntegration: true,
  52. //preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
  53. },
  54. frame: true,
  55. show: true,
  56. //backgroundColor: '#000000'
  57. //titleBarStyle: 'hidden'
  58. };
  59. /* ee框架日志 */
  60. config.logger = {
  61. appLogName: `ee-${dayjs().format('YYYY-MM-DD')}.log`,
  62. errorLogName: `ee-error-${dayjs().format('YYYY-MM-DD')}.log`
  63. }
  64. /* 远程web地址 (可选) */
  65. config.remoteUrl = {
  66. enable: false, // 是否启用
  67. url: 'https://discuz.chat/' // Any web url
  68. };
  69. /* 内置socket服务 */
  70. config.socketServer = {
  71. enable: false, // 是否启用
  72. port: 7070, // 默认端口(如果端口被使用,则随机获取一个)
  73. path: "/socket.io/", // 默认路径名称
  74. connectTimeout: 45000, // 客户端连接超时时间
  75. pingTimeout: 30000, // 心跳检测超时时间
  76. pingInterval: 25000, // 心跳检测间隔
  77. maxHttpBufferSize: 1e8, // 每条消息的数据最大值 1M
  78. transports: ["polling", "websocket"], // http轮询和websocket
  79. cors: {
  80. origin: true, // http协议时,要设置允许跨域
  81. }
  82. };
  83. /* 内置http服务 */
  84. config.httpServer = {
  85. enable: false, // 是否启用
  86. https: {
  87. enable: false,
  88. key: '/public/ssl/localhost+1.key', // key文件
  89. cert: '/public/ssl/localhost+1.pem' // cert文件
  90. },
  91. port: 7071, // 默认端口(如果端口被使用,则随机获取一个)
  92. cors: {
  93. origin: "*" // 跨域
  94. },
  95. body: {
  96. multipart: true,
  97. formidable: {
  98. keepExtensions: true
  99. }
  100. },
  101. filterRequest: {
  102. uris: [
  103. 'favicon.ico'
  104. ],
  105. returnData: '' // 任何数据类型
  106. }
  107. };
  108. /* 主进程 */
  109. config.mainServer = {
  110. host: '127.0.0.1',
  111. port: 7072, // 默认端口(如果端口被使用,则随机获取一个)
  112. };
  113. /**
  114. * 硬件加速
  115. */
  116. config.hardGpu = {
  117. enable: false
  118. };
  119. /* 应用自动升级 (可选) */
  120. config.autoUpdate = {
  121. windows: false, // windows平台
  122. macOS: false, // macOs 需要签名验证
  123. linux: false, // linux平台
  124. options: {
  125. provider: 'generic', // or github, s3, bintray
  126. url: 'http://kodo.qiniu.com/' // resource dir, end with '/'
  127. },
  128. force: false, // 强制更新(运行软件时,检查新版本并后台下载安装)
  129. };
  130. /* 被浏览器唤醒 (可选) */
  131. config.awakeProtocol = {
  132. protocol: 'ee', // 自定义协议名(默认你的应用名称-英文)
  133. args: []
  134. };
  135. /* 托盘 (可选) */
  136. config.tray = {
  137. title: 'EE程序', // 托盘显示标题
  138. icon: '/public/images/tray_logo.png' // 托盘图标
  139. }
  140. return {
  141. ...config
  142. };
  143. }