gsx преди 3 години
родител
ревизия
32077a3dfc
променени са 3 файла, в които са добавени 0 реда и са изтрити 175 реда
  1. 0 101
      electron/config.js
  2. 0 34
      electron/preferences.js
  3. 0 40
      electron/setup.js

+ 0 - 101
electron/config.js

@@ -1,101 +0,0 @@
-'use strict';
-
-const path = require('path');
-const dayjs = require('dayjs');
-const storage = require('./lib/storage');
-
-const config = {
-  developmentMode: {
-    default: 'vue',
-    mode: {
-      vue: {
-        hostname: 'localhost',
-        port: 8080
-      },
-      react: {
-        hostname: 'localhost',
-        port: 3000
-      },
-      ejs: {
-        hostname: 'localhost',
-        port: 7068 // The same as the egg port
-      }
-    }
-  },
-  log: {
-    file: {
-      fileName: path.normalize(storage.getStorageDir() + 'logs/electron-' + dayjs().format('YYYY-MM-DD') + '.log'),
-      level: 'silly', // error, warn, info, verbose, debug, silly
-      format: '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}] {text}',
-      maxSize: '1048576' // 1048576 (1mb) by default.
-    }
-  },
-  windowsOption: {
-    width: 980,
-    height: 650,
-    minWidth: 800,
-    minHeight: 650,
-    webPreferences: {
-      //webSecurity: false,
-      contextIsolation: false, // 设置此项为false后,才可在渲染进程中使用electron api
-      nodeIntegration: true,
-      preload: path.join(__dirname, '../preload.js')
-    },
-    frame: true,
-    //titleBarStyle: 'hidden'
-  },
-  egg: {
-    title: 'electron-egg', // 进程的title属性标识(默认你的应用名称-英文)
-    env: 'prod',
-    port: 7068,
-    hostname: 'localhost',
-    workers: 1
-  },
-  autoUpdate: {
-    windows: false, // windows可以开启;macOs 需要签名验证
-    macOS: false,
-    linux: false,
-    options: {
-      provider: 'generic', // or github, s3, bintray
-      url: 'http://kodo.qiniu.com/' // resource dir, end with '/'
-    }
-  },
-  awakeProtocol: {
-    protocol: 'electron-egg', // 自定义协议名(默认你的应用名称-英文)
-    args: []
-  },
-  crashReport: {
-    submitURL: "",
-    productName: "", 
-    rateLimit: false,
-    uploadToServer: false, 
-    ignoreSystemCrashHandler: true,
-    compress: false
-  },
-  remoteUrl: {
-    enable: false,
-    url: 'https://discuz.chat/' // Any web url
-  },
-  tray: {
-    title: 'EE程序', // 托盘显示标题
-    icon: '/asset/images/tray_logo.png' // 托盘图标
-  }
-}
-
-exports.get = function (flag = '', env = 'prod') {
-  if (flag === 'egg') {
-    const eggConfig = storage.getEggConfig();
-    if (env === 'prod' && eggConfig.port) {
-      config.egg.port = eggConfig.port;
-    }
-    return config.egg;
-  }
-
-  if (flag in config) {
-    return config[flag];
-  }
-
-  return {};
-};
-
-exports = module.exports;

+ 0 - 34
electron/preferences.js

@@ -1,34 +0,0 @@
-'use strict';
-
-const is = require('electron-is');
-const config = require('./config');
-const shortcut = require('./lib/shortcut');
-const tray = require('./lib/tray');
-const awaken = require('./lib/awaken');
-const security = require('./lib/security');
-const chromeExtension = require('./lib/chromeExtension');
-
-module.exports = async () => {
-  // shortcut
-  shortcut.setup();
-
-  // tray
-  tray.setup();
-
-  // awaken 
-  awaken.setup();
-
-  // security 
-  security.setup();
-
-  // chrome extension
-  await chromeExtension.setup();
-
-  // check update
-  const updateConfig = config.get('autoUpdate');
-  if ((is.windows() && updateConfig.windows) || (is.macOS() && updateConfig.macOS)
-    || (is.linux() && updateConfig.linux)) {
-    const autoUpdater = require('./lib/autoUpdater');
-    autoUpdater.checkUpdate();
-  }
-}

+ 0 - 40
electron/setup.js

@@ -1,40 +0,0 @@
-'use strict';
-
-const is = require('electron-is');
-const config = require('./config');
-const storage = require('./lib/storage');
-const api = require('./lib/api');
-const ipc = require('./lib/ipcMain');
-const eLogger = require('./lib/eLogger');
-const crash = require('./lib/crashReport');
-
-module.exports = () => {
-  // 存储模块
-  storage.setup();
-
-  // 日志
-  eLogger.setup();
-
-  // 自动更新
-  loadUpdate();
-
-  // electron业务模块
-  api.setup();
-
-  // ipc模块
-  ipc.setup();
-
-  // 崩溃上报
-  crash.setup();
-}
-
-function loadUpdate () {
-  const updateConfig = config.get('autoUpdate');
-  if ((is.windows() && updateConfig.windows) || (is.macOS() && updateConfig.macOS)
-    || (is.linux() && updateConfig.linux)) {
-    const autoUpdater = require('./lib/autoUpdater');
-    autoUpdater.setup();
-  }
-
-  return true;
-}