From d9a5e6a4a178489963be66e7c3a27d9d29b6b4a1 Mon Sep 17 00:00:00 2001 From: JChehe <574805242@qq.com> Date: Fri, 17 Feb 2017 17:31:05 +0800 Subject: [PATCH] fixed auto-updater bug --- LICENSE | 21 --------------------- app/ipcMainSets.js | 6 +++--- app/src/components/common/Footer.vue | 8 ++++++-- 3 files changed, 9 insertions(+), 26 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a81c9ba..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 AOTU Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/app/ipcMainSets.js b/app/ipcMainSets.js index dbe599c..3655d8d 100644 --- a/app/ipcMainSets.js +++ b/app/ipcMainSets.js @@ -30,6 +30,7 @@ module.exports = function(mainWindow, backgroundWindow) { updateItem = item downloadsFullPath = downloadsPath + item.getFilename() item.setSavePath(downloadsFullPath) + console.log(downloadsFullPath) console.log('getTotalBytes', item.getTotalBytes()) item.on('updated', (event, state) => { if(state === 'interrupted') { @@ -67,12 +68,11 @@ module.exports = function(mainWindow, backgroundWindow) { item = null }) }) + console.log('uodate.url', arg.url) if(process.env.NODE_ENV === 'development') { updateWindow.webContents.downloadURL(arg.url) - console.log(arg.url) - // updateWindow.webContents.downloadURL('https://jdc.jd.com/lab/xcel/xcel/XCel-darwin-x64.zip') } else { - // updateWindow.webContents.downloadURL() + updateWindow.webContents.downloadURL(arg.url) } } }) diff --git a/app/src/components/common/Footer.vue b/app/src/components/common/Footer.vue index 2eb2668..2fb2715 100644 --- a/app/src/components/common/Footer.vue +++ b/app/src/components/common/Footer.vue @@ -159,14 +159,18 @@ if(statusCode === 200) { let res = JSON.parse(response.body) /** - * -1即小于,表示当前版本比服务器上的版本还要新 + * 1即小于,表示当前版本比服务器上的版本还要新 * 0即等于,表示已是最新版 - * 1即大于,表示有更新版本 + * -1即大于,表示有更新版本 */ let compareResult = compareVersions(appInfo.app_version, res.name) + console.log('compareResult', compareResult) + console.log('appInfo.app_version', appInfo.app_version) + console.log('res.name', res.name) if(compareResult === -1) { // 由于 github 对于国内用户下载速度太慢,所以要切换至国内 let downloadUrl = getDownloadUrl(res.name) + console.log(downloadUrl) if(downloadUrl === undefined) { downloadUrl = res.url }