Skip to content

Commit d9a5e6a

Browse files
committed
fixed auto-updater bug
1 parent 2dcc212 commit d9a5e6a

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

LICENSE

-21
This file was deleted.

app/ipcMainSets.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = function(mainWindow, backgroundWindow) {
3030
updateItem = item
3131
downloadsFullPath = downloadsPath + item.getFilename()
3232
item.setSavePath(downloadsFullPath)
33+
console.log(downloadsFullPath)
3334
console.log('getTotalBytes', item.getTotalBytes())
3435
item.on('updated', (event, state) => {
3536
if(state === 'interrupted') {
@@ -67,12 +68,11 @@ module.exports = function(mainWindow, backgroundWindow) {
6768
item = null
6869
})
6970
})
71+
console.log('uodate.url', arg.url)
7072
if(process.env.NODE_ENV === 'development') {
7173
updateWindow.webContents.downloadURL(arg.url)
72-
console.log(arg.url)
73-
// updateWindow.webContents.downloadURL('https://jdc.jd.com/lab/xcel/xcel/XCel-darwin-x64.zip')
7474
} else {
75-
// updateWindow.webContents.downloadURL()
75+
updateWindow.webContents.downloadURL(arg.url)
7676
}
7777
}
7878
})

app/src/components/common/Footer.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,18 @@
159159
if(statusCode === 200) {
160160
let res = JSON.parse(response.body)
161161
/**
162-
* -1即小于,表示当前版本比服务器上的版本还要新
162+
* 1即小于,表示当前版本比服务器上的版本还要新
163163
* 0即等于,表示已是最新版
164-
* 1即大于,表示有更新版本
164+
* -1即大于,表示有更新版本
165165
*/
166166
let compareResult = compareVersions(appInfo.app_version, res.name)
167+
console.log('compareResult', compareResult)
168+
console.log('appInfo.app_version', appInfo.app_version)
169+
console.log('res.name', res.name)
167170
if(compareResult === -1) {
168171
// 由于 github 对于国内用户下载速度太慢,所以要切换至国内
169172
let downloadUrl = getDownloadUrl(res.name)
173+
console.log(downloadUrl)
170174
if(downloadUrl === undefined) {
171175
downloadUrl = res.url
172176
}

0 commit comments

Comments
 (0)