Skip to content

Commit

Permalink
fixed auto-updater bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JChehe committed Feb 17, 2017
1 parent 2dcc212 commit d9a5e6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

6 changes: 3 additions & 3 deletions app/ipcMainSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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)
}
}
})
Expand Down
8 changes: 6 additions & 2 deletions app/src/components/common/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d9a5e6a

Please sign in to comment.