Procházet zdrojové kódy

Merge branch 'dev-frontend' of liangyibo/TuKouKouClient into master

潘求垚 před 11 měsíci
rodič
revize
11b6d6ff6b

+ 19 - 17
electron/addon/autoUpdater/index.js

@@ -5,6 +5,8 @@ const Log = require('ee-core/log');
 const Conf = require('ee-core/config');
 const CoreWindow = require('ee-core/electron/window');
 const Electron = require('ee-core/electron');
+autoUpdater.forceDevUpdateConfig = true
+
 
 /**
  * 自动升级插件
@@ -45,23 +47,23 @@ class AutoUpdaterAddon {
 
     const version = electronApp.getVersion();
     Log.info('[addon:autoUpdater] current version: ', version);
-  
+
     // 设置下载服务器地址
     let server = cfg.options.url;
     let lastChar = server.substring(server.length - 1);
     server = lastChar === '/' ? server : server + "/";
     //Log.info('[addon:autoUpdater] server: ', server);
     cfg.options.url = server;
-  
+
     // 是否后台自动下载
     autoUpdater.autoDownload = cfg.force ? true : false;
-  
+
     try {
       autoUpdater.setFeedURL(cfg.options);
     } catch (error) {
       Log.error('[addon:autoUpdater] setFeedURL error : ', error);
     }
-  
+
     autoUpdater.on('checking-for-update', () => {
       //sendStatusToWindow('正在检查更新...');
     })
@@ -88,7 +90,7 @@ class AutoUpdaterAddon {
       let transferredSize = this.bytesChange(progressObj.transferred);
       let text = '已下载 ' + percentNumber + '%';
       text = text + ' (' + transferredSize + "/" + totalSize + ')';
-  
+
       let info = {
         status: status.downloading,
         desc: text,
@@ -106,7 +108,7 @@ class AutoUpdaterAddon {
 
       // 托盘插件默认会阻止窗口关闭,这里设置允许关闭窗口
       Electron.extra.closeWindow = true;
-      
+
       autoUpdater.quitAndInstall();
       // const mainWindow = CoreWindow.getMainWindow();
       // if (mainWindow) {
@@ -122,7 +124,7 @@ class AutoUpdaterAddon {
   checkUpdate () {
     autoUpdater.checkForUpdates();
   }
-  
+
   /**
    * 下载更新
    */
@@ -139,32 +141,32 @@ class AutoUpdaterAddon {
     const win = CoreWindow.getMainWindow();
     win.webContents.send(channel, textJson);
   }
-  
+
   /**
    * 单位转换
    */
   bytesChange (limit) {
     let size = "";
-    if(limit < 0.1 * 1024){                            
+    if(limit < 0.1 * 1024){
       size = limit.toFixed(2) + "B";
-    }else if(limit < 0.1 * 1024 * 1024){            
+    }else if(limit < 0.1 * 1024 * 1024){
       size = (limit/1024).toFixed(2) + "KB";
-    }else if(limit < 0.1 * 1024 * 1024 * 1024){        
+    }else if(limit < 0.1 * 1024 * 1024 * 1024){
       size = (limit/(1024 * 1024)).toFixed(2) + "MB";
-    }else{                                            
+    }else{
       size = (limit/(1024 * 1024 * 1024)).toFixed(2) + "GB";
     }
 
-    let sizeStr = size + "";                        
-    let index = sizeStr.indexOf(".");                    
-    let dou = sizeStr.substring(index + 1 , index + 3);            
+    let sizeStr = size + "";
+    let index = sizeStr.indexOf(".");
+    let dou = sizeStr.substring(index + 1 , index + 3);
     if(dou == "00"){
         return sizeStr.substring(0, index) + sizeStr.substring(index + 3, index + 5);
     }
 
     return size;
-  }  
+  }
 }
 
 AutoUpdaterAddon.toString = () => '[class AutoUpdaterAddon]';
-module.exports = AutoUpdaterAddon;
+module.exports = AutoUpdaterAddon;

+ 4 - 1
electron/config/builder.json

@@ -6,6 +6,9 @@
     "output": "out"
   },
   "asar": true,
+  "asarUnpack": [
+    "**/*.node"
+  ],
   "files": [
     "**/*",
     "!frontend/",
@@ -31,7 +34,7 @@
   "publish": [
     {
       "provider": "generic",
-      "url": "https://github.com/wallace5303/electron-egg"
+      url: "https://ossimg.valimart.net/tkk"
     }
   ],
   "mac": {

+ 7 - 5
electron/config/config.default.js

@@ -109,10 +109,12 @@ module.exports = (appInfo) => {
   /**
    * 主进程
    */
+/*
   config.mainServer = {
     protocol: "file://",
     indexPath: "/public/dist/index.html",
   };
+*/
 
   /**
    * 硬件加速
@@ -160,7 +162,7 @@ module.exports = (appInfo) => {
     },
     tray: {
       enable: true,
-      title: "EE程序",
+      title: "图扣扣",
       icon: "/public/images/tray.png",
     },
     security: {
@@ -173,14 +175,14 @@ module.exports = (appInfo) => {
     },
     autoUpdater: {
       enable: true,
-      windows: false,
+      windows: true,
       macOS: false,
-      linux: false,
+      linux: true,
       options: {
         provider: "generic",
-        url: "http://kodo.qiniu.com/",
+        url: "https://ossimg.valimart.net/tkk/",
       },
-      force: false,
+      force: true,
     },
   };
 

+ 1 - 1
electron/config/config.local.js

@@ -31,7 +31,7 @@ module.exports = (appInfo) => {
   /**
    * 应用程序顶部菜单
    */
-  config.openAppMenu = false;
+  config.openAppMenu = true;
 
 
   /**

+ 1 - 1
electron/config/config.prod.js

@@ -27,7 +27,7 @@ module.exports = (appInfo) => {
    */
   config.remoteUrl = {
     enable: true,
-    url: 'http://tkk.pubdata.cn'
+    url: 'https://tkk.valimart.net'
   };
 
   return {

+ 11 - 0
electron/controller/utils.js

@@ -3,6 +3,7 @@
 const { Controller } = require('ee-core');
 const { shell  } = require('electron');
 const Log = require('ee-core/log');
+const autoUpdater = require('../addon/autoUpdater');
 
 /**
  * example
@@ -33,6 +34,16 @@ class UtilsController extends Controller {
   async shellFun (params) {
     shell[params.action](params.params)
   }
+
+  async checkUpdate () {
+
+    let updaterAddon = new autoUpdater();
+    updaterAddon.create();
+
+    if(updaterAddon.checkUpdate()){
+      return
+    }
+  }
 }
 
 UtilsController.toString = () => '[class ExampleController]';

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "tkk",
-  "version": "1.0.0",
+  "version": "1.1.0",
   "description": "图扣扣,AI图片处理,图片编辑智能修图,在线图片优化,自动抠图,图片背景移除,照片美化,批量图片处理,高清图片还原,创意图片合成",
   "main": "main.js",
   "scripts": {