config.default.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
  57. //backgroundColor: '#000000'
  58. //titleBarStyle: 'hidden'
  59. };
  60. /* ee框架日志 */
  61. config.logger = {
  62. appLogName: `ee-${dayjs().format('YYYY-MM-DD')}.log`,
  63. errorLogName: `ee-error-${dayjs().format('YYYY-MM-DD')}.log`
  64. }
  65. /* 远程web地址 (可选) */
  66. config.remoteUrl = {
  67. enable: false, // 是否启用
  68. url: 'https://discuz.chat/' // Any web url
  69. };
  70. /* 内置socket服务 */
  71. config.socketServer = {
  72. enable: false, // 是否启用
  73. port: 7070, // 默认端口(如果端口被使用,则随机获取一个)
  74. path: "/socket.io/", // 默认路径名称
  75. connectTimeout: 45000, // 客户端连接超时时间
  76. pingTimeout: 30000, // 心跳检测超时时间
  77. pingInterval: 25000, // 心跳检测间隔
  78. maxHttpBufferSize: 1e8, // 每条消息的数据最大值 1M
  79. transports: ["polling", "websocket"], // http轮询和websocket
  80. cors: {
  81. origin: true, // http协议时,要设置允许跨域
  82. }
  83. };
  84. /* 内置http服务 */
  85. config.httpServer = {
  86. enable: false, // 是否启用
  87. https: {
  88. enable: false,
  89. key: '/public/ssl/localhost+1.key', // key文件
  90. cert: '/public/ssl/localhost+1.pem' // cert文件
  91. },
  92. port: 7071, // 默认端口(如果端口被使用,则随机获取一个)
  93. cors: {
  94. origin: "*" // 跨域
  95. },
  96. body: {
  97. multipart: true,
  98. formidable: {
  99. keepExtensions: true
  100. }
  101. },
  102. filterRequest: {
  103. uris: [
  104. 'favicon.ico'
  105. ],
  106. returnData: '' // 任何数据类型
  107. }
  108. };
  109. /* 主进程 */
  110. config.mainServer = {
  111. host: '127.0.0.1',
  112. port: 7072, // 默认端口(如果端口被使用,则随机获取一个)
  113. };
  114. /**
  115. * 硬件加速
  116. */
  117. config.hardGpu = {
  118. enable: false
  119. };
  120. /* 应用自动升级 (可选) */
  121. config.autoUpdate = {
  122. windows: false, // windows平台
  123. macOS: false, // macOs 需要签名验证
  124. linux: false, // linux平台
  125. options: {
  126. provider: 'generic', // or github, s3, bintray
  127. url: 'http://kodo.qiniu.com/' // resource dir, end with '/'
  128. },
  129. force: false, // 强制更新(运行软件时,检查新版本并后台下载安装)
  130. };
  131. /* 被浏览器唤醒 (可选) */
  132. config.awakeProtocol = {
  133. protocol: 'ee', // 自定义协议名(默认你的应用名称-英文)
  134. args: []
  135. };
  136. /* 托盘 (可选) */
  137. config.tray = {
  138. title: 'EE程序', // 托盘显示标题
  139. icon: '/public/images/tray_logo.png' // 托盘图标
  140. }
  141. return {
  142. ...config
  143. };
  144. }