Skip to content

Commit 0427eed

Browse files
peterpeter
authored andcommitted
v2.0.1
1 parent af51498 commit 0427eed

File tree

3 files changed

+7
-194
lines changed

3 files changed

+7
-194
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
## Download ダウンロード 下載
88

9-
### [The latest 最新版 v2.0.0](https://github.com/QTGate/QTGate-Desktop-Client/releases/latest/)
9+
### [The latest 最新版 v2.0.1](https://github.com/QTGate/QTGate-Desktop-Client/releases/latest/)
1010

11-
[windows32](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.0/CoNET.Setup.2.0.0.ia32.exe)
11+
[windows32](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.1/CoNET.Setup.2.0.1.ia32.exe)
1212

13-
[windows64](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.0/CoNET.Setup.2.0.0.exe)
13+
[windows64](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.1/CoNET.Setup.2.0.1.exe)
1414

15-
[MacOS](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.0/CoNET-2.0.0.dmg)
15+
[MacOS](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.1/CoNET-2.0.1.dmg)
1616

17-
[Linux deb](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.0/CoNET_2.0.0_amd64.deb)
17+
[Linux deb](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.1/CoNET_2.0.1_amd64.deb)
1818

19-
[Linux pacman](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.0/CoNET-2.0.0.pacman)
19+
[Linux pacman](https://github.com/QTGate/QTGate-Desktop-Client/releases/download/v2.0.1/CoNET-2.0.1.pacman)
2020

2121
[WInXP or npm install](https://github.com/QTGate/QTGate-Desktop-Client/wiki/WInXP%E4%BB%A5%E5%8F%8ANPM%E7%92%B0%E5%A2%83%E4%B8%8B%E5%AE%89%E8%A3%9DCoNET)
2222

index.js

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Object.defineProperty(exports, "__esModule", { value: true });
1818
const DEBUG = false;
1919
const port = 3000;
20-
const Fs = require("fs");
2120
const path_1 = require("path");
2221
const url_1 = require("url");
2322
const { app, BrowserWindow, Tray, Menu, dialog, autoUpdater, desktopCapturer, shell } = require('electron');
@@ -86,78 +85,10 @@ if (makeSingleInstance()) {
8685
}
8786
// squirrel event handled and app will exit in 1000ms, so don't do anything else
8887
const version = app.getVersion();
89-
var lang;
90-
(function (lang) {
91-
lang[lang["zh"] = 0] = "zh";
92-
lang[lang["ja"] = 1] = "ja";
93-
lang[lang["en"] = 2] = "en";
94-
lang[lang["tw"] = 3] = "tw";
95-
})(lang || (lang = {}));
96-
let isSingleInstanceCheck = true;
9788
let localServer1 = null;
9889
let tray = null;
9990
let mainWindow = null;
10091
let doReady = false;
101-
const hideWindowDownload = (downloadUrl, saveFilePath, Callback) => {
102-
let _err = null;
103-
if (!downloadUrl) {
104-
return Callback(new Error('no url'));
105-
}
106-
Fs.access(saveFilePath, err => {
107-
if (!err) {
108-
return Callback();
109-
}
110-
let win = new BrowserWindow({ show: DEBUG });
111-
DEBUG ? win.webContents.openDevTools() : null;
112-
//win.maximize ()
113-
//win.setIgnoreMouseEvents ( true )
114-
let startTime = 0;
115-
let downloadBytes = 0;
116-
win.webContents.session.once('will-download', (event, item, webContents) => {
117-
item.setSavePath(saveFilePath);
118-
//startTime = new Date ().getTime ()
119-
console.log(`start download file from [${downloadUrl}]\r\n saveTo [${saveFilePath}]`);
120-
/*
121-
const DEBUG = true
122-
item.on ( 'updated', ( event, state ) => {
123-
if ( state === 'interrupted') {
124-
if ( DEBUG )
125-
console.log ( 'hideWindowDownload: Download is interrupted but can be resumed' + item.getURL() )
126-
return
127-
}
128-
129-
if ( item.isPaused ()) {
130-
if ( DEBUG )
131-
console.log ( 'hideWindowDownload: Download is interrupted but can be resumed' + item.getURL())
132-
return
133-
}
134-
downloadBytes = item.getReceivedBytes()
135-
if ( DEBUG )
136-
console.log ( `${item.getFilename()} Received bytes: ${item.getReceivedBytes()}`)
137-
return
138-
})
139-
*/
140-
item.once('done', (event, state) => {
141-
if (state === 'completed') {
142-
console.log(`download [${saveFilePath}] success!`);
143-
return win.close();
144-
}
145-
return Fs.unlink(saveFilePath, err => {
146-
_err = new Error(state);
147-
console.log(`Download failed: ${state}`);
148-
return win.close();
149-
});
150-
});
151-
});
152-
win.once('closed', () => {
153-
win = null;
154-
if (_err)
155-
return Callback(_err);
156-
return Callback();
157-
});
158-
return win.loadURL(downloadUrl);
159-
});
160-
};
16192
const _doUpdate = (tag_name, _port) => {
16293
let url = null;
16394
if (process.platform === 'darwin') {
@@ -189,20 +120,6 @@ const _doUpdate = (tag_name, _port) => {
189120
autoUpdater.setFeedURL(url);
190121
autoUpdater.checkForUpdates();
191122
};
192-
const dirTitleErr = [
193-
[
194-
'文件夹创建错误',
195-
'フォルダ作成エラー',
196-
'Create folder error',
197-
'文件夾創建錯誤'
198-
],
199-
[
200-
'QTGate在[__folder__]位置创建文件夹错误,QTGate安装不能够继续进行,请检查您的系统。',
201-
'QTGateは[__folder__]にフォルダを作成エラー、QTGateはインストールができません。あなたのシステムをチェックしてください。',
202-
'QTGate install got error when make a folder at [__folder__], please check your OS system and do QTGate install again.',
203-
'QTGate在[__folder__]位置創建文件夾錯誤,QTGate安裝不能夠繼續進行,請檢查您的系統。'
204-
]
205-
];
206123
const createWindow = () => {
207124
shell.openExternal(`http://127.0.0.1:${port}`);
208125
};
@@ -255,11 +172,6 @@ const data11 = [
255172
]
256173
}
257174
];
258-
const showError = (title, detail, app) => {
259-
dialog.showErrorBox(title, detail);
260-
if (app)
261-
return app.quit();
262-
};
263175
const getLocalLanguage = (lang) => {
264176
if (/^zh-TW|^zh-HK|^zh-SG/i.test(lang))
265177
return 3;

index.ts

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,8 @@
1717
const DEBUG = false
1818
const port = 3000
1919

20-
import * as Fs from 'fs'
21-
import * as Os from 'os'
22-
import { join, resolve, basename } from 'path'
23-
import * as freePort from 'portastic'
20+
import { join } from 'path'
2421
import { format } from 'url'
25-
import { spawn } from 'child_process'
26-
import * as path from 'path'
27-
import * as Crypto from 'crypto'
2822

2923
const { app, BrowserWindow, Tray, Menu, dialog, autoUpdater, desktopCapturer, shell } = require ( 'electron' )
3024

@@ -113,84 +107,12 @@ if ( makeSingleInstance ()) {
113107
// squirrel event handled and app will exit in 1000ms, so don't do anything else
114108
const version = app.getVersion()
115109

116-
enum lang { 'zh', 'ja', 'en', 'tw' }
117-
118-
let isSingleInstanceCheck = true
119110
let localServer1 = null
120111

121112
let tray = null
122113
let mainWindow = null
123114
let doReady = false
124115

125-
const hideWindowDownload = ( downloadUrl, saveFilePath, Callback ) => {
126-
let _err = null
127-
if ( !downloadUrl ) {
128-
return Callback ( new Error ( 'no url' ))
129-
}
130-
Fs.access ( saveFilePath, err => {
131-
if ( ! err ) {
132-
return Callback ()
133-
}
134-
135-
let win = new BrowserWindow ({ show: DEBUG })
136-
DEBUG ? win.webContents.openDevTools() : null
137-
//win.maximize ()
138-
//win.setIgnoreMouseEvents ( true )
139-
140-
let startTime = 0
141-
let downloadBytes = 0
142-
143-
win.webContents.session.once ( 'will-download', ( event, item, webContents ) => {
144-
145-
item.setSavePath ( saveFilePath )
146-
//startTime = new Date ().getTime ()
147-
console.log ( `start download file from [${ downloadUrl }]\r\n saveTo [${ saveFilePath }]`)
148-
/*
149-
const DEBUG = true
150-
item.on ( 'updated', ( event, state ) => {
151-
if ( state === 'interrupted') {
152-
if ( DEBUG )
153-
console.log ( 'hideWindowDownload: Download is interrupted but can be resumed' + item.getURL() )
154-
return
155-
}
156-
157-
if ( item.isPaused ()) {
158-
if ( DEBUG )
159-
console.log ( 'hideWindowDownload: Download is interrupted but can be resumed' + item.getURL())
160-
return
161-
}
162-
downloadBytes = item.getReceivedBytes()
163-
if ( DEBUG )
164-
console.log ( `${item.getFilename()} Received bytes: ${item.getReceivedBytes()}`)
165-
return
166-
})
167-
*/
168-
item.once ( 'done', ( event, state ) => {
169-
if ( state === 'completed' ) {
170-
console.log ( `download [${ saveFilePath }] success!`)
171-
172-
return win.close ()
173-
}
174-
175-
return Fs.unlink ( saveFilePath, err => {
176-
_err = new Error ( state )
177-
console.log ( `Download failed: ${state}` )
178-
return win.close ()
179-
})
180-
181-
})
182-
})
183-
win.once ( 'closed', () => {
184-
185-
win = null
186-
if ( _err )
187-
return Callback ( _err )
188-
return Callback ()
189-
})
190-
return win.loadURL ( downloadUrl )
191-
})
192-
}
193-
194116
const _doUpdate = ( tag_name: string, _port ) => {
195117
let url = null
196118

@@ -229,21 +151,6 @@ const _doUpdate = ( tag_name: string, _port ) => {
229151
autoUpdater.checkForUpdates ()
230152
}
231153

232-
const dirTitleErr = [
233-
[
234-
'文件夹创建错误',
235-
'フォルダ作成エラー',
236-
'Create folder error',
237-
'文件夾創建錯誤'
238-
],
239-
[
240-
'QTGate在[__folder__]位置创建文件夹错误,QTGate安装不能够继续进行,请检查您的系统。',
241-
'QTGateは[__folder__]にフォルダを作成エラー、QTGateはインストールができません。あなたのシステムをチェックしてください。',
242-
'QTGate install got error when make a folder at [__folder__], please check your OS system and do QTGate install again.',
243-
'QTGate在[__folder__]位置創建文件夾錯誤,QTGate安裝不能夠繼續進行,請檢查您的系統。'
244-
]
245-
]
246-
247154
const createWindow = () => {
248155
shell.openExternal (`http://127.0.0.1:${ port }`)
249156

@@ -300,12 +207,6 @@ const data11 = [
300207
}
301208
]
302209

303-
const showError = ( title: string, detail: string, app ) => {
304-
dialog.showErrorBox ( title, detail)
305-
if ( app )
306-
return app.quit()
307-
}
308-
309210
const getLocalLanguage = ( lang: string ) => {
310211
if ( /^zh-TW|^zh-HK|^zh-SG/i.test ( lang ))
311212
return 3

0 commit comments

Comments
 (0)