Skip to content

Commit 42857b1

Browse files
committed
修改更新源为aotu
1 parent 5f493a7 commit 42857b1

File tree

6 files changed

+50
-17
lines changed

6 files changed

+50
-17
lines changed

app/ipcMainSets.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let savePath = '',
1515
updateWindow,
1616
updateItem,
1717
downloadsFullPath
18-
console.log(version)
18+
1919
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@')
2020

2121
module.exports = function(mainWindow, backgroundWindow) {
@@ -63,7 +63,6 @@ module.exports = function(mainWindow, backgroundWindow) {
6363
console.log(`Download failed: ${state}`)
6464
}
6565
item.removeAllListeners()
66-
updateItem.removeAllListeners()
6766
updateItem = null
6867
item = null
6968
})
@@ -81,6 +80,8 @@ module.exports = function(mainWindow, backgroundWindow) {
8180
var win = new BrowserWindow({
8281
height: 160,
8382
width: 550,
83+
minWidth: 550,
84+
minHeight: 160,
8485
title: '下载最新版的XCel',
8586
backgroundColor: "#f5f5f5"
8687
})

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "xcel",
33
"product": "XCel",
4-
"version": "1.2.1",
4+
"version": "1.3.0",
55
"description": "An ultimate excel data filter",
66
"author": "AOTULabs <[email protected]>",
77
"main": "electron.js",

app/src/components/common/Footer.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import request from 'request'
4747
import compareVersions from 'compare-versions'
4848
import { openExternal } from '../../utils/openExternal'
49-
import { appInfo } from '../../utils/appInfo'
49+
import { appInfo, getDownloadUrl } from '../../utils/appInfo'
5050
import {
5151
getSideBarStatus,
5252
getFilterPanelStatus,
@@ -139,7 +139,7 @@
139139
},
140140
checkUpdate(isClick) {
141141
let that = this
142-
142+
console.log(appInfo.updateUrl)
143143
request({
144144
url: appInfo.updateUrl,
145145
method: 'GET'
@@ -158,8 +158,13 @@
158158
*/
159159
let compareResult = compareVersions(appInfo.app_version, res.name)
160160
if(compareResult === -1) {
161+
// 由于 github 对于国内用户下载速度太慢,所以要切换至国内
162+
let downloadUrl = getDownloadUrl(res.name)
163+
if(downloadUrl === undefined) {
164+
downloadUrl = res.url
165+
}
161166
that.toggleUpdateDialog(true)
162-
that.setUpdateUrl(res.url)
167+
that.setUpdateUrl(downloadUrl)
163168
that.setUpdateVersion(res.name)
164169
that.setUpdateNotes(res.notes)
165170
that.setUpdatePubDate(res.pub_date)

app/src/components/common/UpdateDialog.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
left: 50%;
119119
transform: translate(-50%, -80%);
120120
width: 500px;
121-
height: 320px;
121+
height: 400px;
122122
background-color: #fff;
123123
box-shadow: 0 2px 4px rgba(0,0,0,.5);
124124
display: flex;
@@ -149,18 +149,18 @@
149149
&_content {
150150
.has_new & {
151151
display: flex;
152-
max-height: 210px;
153152
}
154153
.no_new & {
154+
padding: 15px 20px;
155155
p {
156156
margin-bottom: 10px;
157157
}
158158
}
159159
160160
overflow: auto;
161161
flex-grow: 1;
162-
flex-shrink: 0;
163-
padding: 15px 20px;
162+
flex-shrink: 1;
163+
padding: 0 20px;
164164
position: relative;
165165
}
166166
&_footer {

app/src/utils/appInfo.js

+32-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@ import os from 'os'
55
import path from 'path'
66
import packageJSON from '../../package.json'
77

8+
const UPDATE_HOST = 'http://nuts-xcel.aotu.io/'
9+
const UPDATE_HOST_DEV = 'http://nuts-xcel.aotu.io/'
10+
11+
const DOWNLOAD_HOST = 'http://jdc.jd.com/lab/xcel/download/'
812

913
// dev 时显示了 app.getName()、app.getVersion()都返回Electron的信息,但打包后正常
1014
let app = remote.app,
1115
isDev = process.env.NODE_ENV === 'development',
1216
app_version = isDev ? packageJSON.version : app.getVersion(),
1317
name = isDev ? packageJSON.name : app.getName(),
14-
platform = os.platform() + '_' + os.arch(),
15-
updateUrl = isDev ? 'http://localhost:5000/update/'+platform+'/'+app_version
16-
: 'http://localhost:5000/update/'+platform+'/'+app_version
18+
platform = os.platform(),
19+
arch = os.arch(),
20+
updateUrl = isDev ? UPDATE_HOST_DEV+'update/'+ platform + '_' + arch +'/'+app_version
21+
: UPDATE_HOST+'update/'+ platform + '_' + arch +'/'+app_version
1722

1823
export const appInfo = {
1924
platform,
@@ -22,5 +27,27 @@ export const appInfo = {
2227
ele_version: process.versions.electron, // electron 版本
2328
chrome_version: process.versions.chrome, // chrome 版本
2429
locales: app.getLocale(), // 本地化
25-
updateUrl
26-
}
30+
updateUrl,
31+
downloadUrl: DOWNLOAD_HOST
32+
};
33+
34+
35+
export function getDownloadUrl(version) {
36+
let prefix = `${DOWNLOAD_HOST}${version}/`
37+
if(platform === 'darwin') {
38+
return `${prefix}${name}-${version}.dmg`
39+
} else if(platform === 'win32') {
40+
if(arch === 'ia32' || arch === 'x86') {
41+
return `${prefix}${name} Setup ${version}-ia32.exe`
42+
} else if(arch === 'x64') {
43+
return `${prefix}${name} Setup ${version}.exe`
44+
}
45+
} else if(platform === 'linux') {
46+
if(arch === 'ia32' || arch === 'x86') {
47+
return `${prefix}${name}-${version}-linux-ia32.zip`
48+
} else if(arch === 'x64') {
49+
return `${prefix}${name}-${version}-linux-x64.zip`
50+
}
51+
}
52+
return undefined
53+
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xcel",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "An ultimate excel data filter",
55
"scripts": {
66
"build": "node tasks/release.js",
@@ -14,7 +14,7 @@
1414
"vue:route": "node tasks/vue/route.js",
1515
"pack_ori:electron-packager": "cross-env NODE_ENV=production webpack -p --progress --colors",
1616
"pack": "build --dir",
17-
"dist": "build -mwl"
17+
"dist": "build -mwl --ia32 --x64"
1818
},
1919
"build": {
2020
"appId": "com.electron.xcel",

0 commit comments

Comments
 (0)