config.default.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. 'use strict';
  2. const path = require('path');
  3. /**
  4. * 默认配置
  5. */
  6. module.exports = (appInfo) => {
  7. const config = {};
  8. /**
  9. * 开发者工具
  10. */
  11. config.openDevTools = true;
  12. /**
  13. * 应用程序顶部菜单
  14. */
  15. config.openAppMenu = true;
  16. /**
  17. * 主窗口
  18. */
  19. config.windowsOption = {
  20. title: 'EE框架',
  21. width: 3840,
  22. height: 2160,
  23. minWidth: 400,
  24. minHeight: 300,
  25. frame: true,
  26. // fullscreen: true,
  27. // titleBarStyle: 'hiddenInset', // 部分系统可能需要自定义标题栏样式
  28. webPreferences: {
  29. webSecurity: false,
  30. contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
  31. nodeIntegration: true,
  32. preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
  33. },
  34. show: false,
  35. icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
  36. // 添加全屏配置
  37. // fullscreen: true, // 启用全屏
  38. // resizable: false // 禁用窗口缩放(全屏时通常不需要)
  39. };
  40. /**
  41. * ee框架日志
  42. */
  43. config.logger = {
  44. encoding: 'utf8',
  45. level: 'INFO',
  46. outputJSON: false,
  47. buffer: true,
  48. enablePerformanceTimer: false,
  49. rotator: 'day',
  50. appLogName: 'ee.log',
  51. coreLogName: 'ee-core.log',
  52. errorLogName: 'ee-error.log'
  53. }
  54. /**
  55. * 远程模式-web地址
  56. */
  57. config.remoteUrl = {
  58. enable: true,
  59. url: 'http://localhost:3000'
  60. };
  61. /**
  62. * 内置socket服务
  63. */
  64. config.socketServer = {
  65. enable: false,
  66. port: 7070,
  67. path: "/socket.io/",
  68. connectTimeout: 45000,
  69. pingTimeout: 30000,
  70. pingInterval: 25000,
  71. maxHttpBufferSize: 1e8,
  72. transports: ["polling", "websocket"],
  73. cors: {
  74. origin: true,
  75. },
  76. channel: 'c1'
  77. };
  78. /**
  79. * 内置http服务
  80. */
  81. config.httpServer = {
  82. enable: true,
  83. https: {
  84. enable: false,
  85. key: '/public/ssl/localhost+1.key',
  86. cert: '/public/ssl/localhost+1.pem'
  87. },
  88. host: '127.0.0.1',
  89. port: 7071,
  90. cors: {
  91. origin: "*"
  92. },
  93. body: {
  94. multipart: true,
  95. formidable: {
  96. keepExtensions: true
  97. }
  98. },
  99. filterRequest: {
  100. uris: [
  101. 'favicon.ico'
  102. ],
  103. returnData: ''
  104. }
  105. };
  106. /**
  107. * 主进程
  108. */
  109. config.mainServer = {
  110. protocol: 'file://',
  111. indexPath: '/public/dist/index.html',
  112. };
  113. /**
  114. * 硬件加速
  115. */
  116. config.hardGpu = {
  117. enable: true
  118. };
  119. /**
  120. * 异常捕获
  121. */
  122. config.exception = {
  123. mainExit: false,
  124. childExit: true,
  125. rendererExit: true,
  126. };
  127. /**
  128. * jobs
  129. */
  130. config.jobs = {
  131. messageLog: true
  132. };
  133. /**
  134. * 插件功能
  135. */
  136. config.addons = {
  137. window: {
  138. enable: true,
  139. },
  140. tray: {
  141. enable: true,
  142. title: 'EE程序',
  143. icon: '/public/images/tray.png'
  144. },
  145. security: {
  146. enable: true,
  147. },
  148. awaken: {
  149. enable: true,
  150. protocol: 'ee',
  151. args: []
  152. },
  153. autoUpdater: {
  154. enable: true,
  155. windows: false,
  156. macOS: false,
  157. linux: false,
  158. options: {
  159. provider: 'generic',
  160. url: 'http://kodo.qiniu.com/'
  161. },
  162. force: false,
  163. }
  164. };
  165. return {
  166. ...config
  167. };
  168. }