config.default.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. 'use strict';
  2. const path = require('path');
  3. /**
  4. * 默认配置
  5. */
  6. module.exports = (appInfo) => {
  7. const config = {};
  8. /**
  9. * 开发者工具
  10. */
  11. config.openDevTools = false;
  12. /**
  13. * 应用程序顶部菜单
  14. */
  15. config.openAppMenu = false;
  16. /**
  17. * 主窗口
  18. */
  19. config.windowsOption = {
  20. title: '智惠映AI自动拍照机',
  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: false,
  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. * Cross-language service
  80. * 跨语言服务
  81. * 例如:执行go的二进制程序,默认目录为 ./extraResources/
  82. */
  83. config.cross = {
  84. go: {
  85. enable: false,
  86. name: "goapp",
  87. args: ["--port=7073"],
  88. appExit: true,
  89. },
  90. python: {
  91. enable: false,
  92. name: "pyapp",
  93. cmd: "./py/pyapp",
  94. directory: "./py",
  95. args: ["--port=7074"],
  96. appExit: true,
  97. },
  98. };
  99. /**
  100. * 内置http服务
  101. */
  102. config.httpServer = {
  103. enable: true,
  104. https: {
  105. enable: false,
  106. key: "/public/ssl/localhost+1.key",
  107. cert: "/public/ssl/localhost+1.pem",
  108. },
  109. host: "127.0.0.1",
  110. port: 7071,
  111. cors: {
  112. origin: "*",
  113. },
  114. body: {
  115. multipart: true,
  116. formidable: {
  117. keepExtensions: true,
  118. },
  119. },
  120. filterRequest: {
  121. uris: ["favicon.ico"],
  122. returnData: "",
  123. },
  124. };
  125. /**
  126. * 主进程
  127. */
  128. config.mainServer = {
  129. protocol: 'file://',
  130. indexPath: '/public/dist/index.html',
  131. };
  132. /**
  133. * 硬件加速
  134. */
  135. config.hardGpu = {
  136. enable: true,
  137. };
  138. /**
  139. * 异常捕获
  140. */
  141. config.exception = {
  142. mainExit: false,
  143. childExit: true,
  144. rendererExit: true,
  145. };
  146. /**
  147. * jobs
  148. */
  149. config.jobs = {
  150. messageLog: true,
  151. };
  152. /**
  153. * 插件功能
  154. */
  155. config.addons = {
  156. window: {
  157. enable: true,
  158. },
  159. tray: {
  160. enable: true,
  161. title: "智惠映AI自动拍照机",
  162. icon: "/public/images/tray.png",
  163. },
  164. security: {
  165. enable: true,
  166. },
  167. awaken: {
  168. enable: true,
  169. protocol: "ee",
  170. args: [],
  171. },
  172. autoUpdater: {
  173. enable: true,
  174. windows: false,
  175. macOS: false,
  176. linux: false,
  177. options: {
  178. provider: "generic",
  179. url: "http://kodo.qiniu.com/",
  180. },
  181. force: false,
  182. },
  183. };
  184. return {
  185. ...config,
  186. };
  187. }