config.default.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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: 1400,
  22. height: 800,
  23. minWidth: 400,
  24. minHeight: 300,
  25. webPreferences: {
  26. //webSecurity: false,
  27. contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
  28. nodeIntegration: true,
  29. //preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
  30. },
  31. frame: true,
  32. show: false,
  33. icon: path.join(appInfo.home, "public", "images", "logo-32.png"),
  34. };
  35. /**
  36. * ee框架日志
  37. */
  38. config.logger = {
  39. encoding: "utf8",
  40. level: "INFO",
  41. outputJSON: false,
  42. buffer: true,
  43. enablePerformanceTimer: false,
  44. rotator: "day",
  45. appLogName: "ee.log",
  46. coreLogName: "ee-core.log",
  47. errorLogName: "ee-error.log",
  48. };
  49. /**
  50. * 远程模式-web地址
  51. */
  52. config.remoteUrl = {
  53. enable: false,
  54. url: 'http://tkk.pubdata.cn'
  55. };
  56. /**
  57. * 内置socket服务
  58. */
  59. config.socketServer = {
  60. enable: false,
  61. port: 7070,
  62. path: "/socket.io/",
  63. connectTimeout: 45000,
  64. pingTimeout: 30000,
  65. pingInterval: 25000,
  66. maxHttpBufferSize: 1e8,
  67. transports: ["polling", "websocket"],
  68. cors: {
  69. origin: true,
  70. },
  71. channel: "c1",
  72. };
  73. /**
  74. * 内置http服务
  75. */
  76. config.httpServer = {
  77. enable: false,
  78. https: {
  79. enable: false,
  80. key: "/public/ssl/localhost+1.key",
  81. cert: "/public/ssl/localhost+1.pem",
  82. },
  83. host: "127.0.0.1",
  84. port: 7071,
  85. cors: {
  86. origin: "*",
  87. },
  88. body: {
  89. multipart: true,
  90. formidable: {
  91. keepExtensions: true,
  92. },
  93. },
  94. filterRequest: {
  95. uris: ["favicon.ico"],
  96. returnData: "",
  97. },
  98. };
  99. /**
  100. * 主进程
  101. */
  102. config.mainServer = {
  103. protocol: "file://",
  104. indexPath: "/public/dist/index.html",
  105. };
  106. /**
  107. * 硬件加速
  108. */
  109. config.hardGpu = {
  110. enable: true,
  111. };
  112. /**
  113. * 异常捕获
  114. */
  115. config.exception = {
  116. mainExit: false,
  117. childExit: true,
  118. rendererExit: true,
  119. };
  120. /**
  121. * jobs
  122. */
  123. config.jobs = {
  124. messageLog: true,
  125. };
  126. /**
  127. * Cross-language service
  128. * 跨语言服务
  129. * 例如:执行go的二进制程序,默认目录为 ./extraResources/
  130. */
  131. config.cross = {
  132. python: {
  133. enable: false,
  134. name: "pyapp",
  135. cmd: "./py/pyapp",
  136. directory: "./py",
  137. args: ["--port=7074"],
  138. appExit: true,
  139. },
  140. };
  141. /**
  142. * 插件功能
  143. */
  144. config.addons = {
  145. window: {
  146. enable: true,
  147. },
  148. tray: {
  149. enable: true,
  150. title: "EE程序",
  151. icon: "/public/images/tray.png",
  152. },
  153. security: {
  154. enable: true,
  155. },
  156. awaken: {
  157. enable: true,
  158. protocol: "ee",
  159. args: [],
  160. },
  161. autoUpdater: {
  162. enable: true,
  163. windows: false,
  164. macOS: false,
  165. linux: false,
  166. options: {
  167. provider: "generic",
  168. url: "http://kodo.qiniu.com/",
  169. },
  170. force: false,
  171. },
  172. };
  173. return {
  174. ...config,
  175. };
  176. };