Skip to content

Commit 517f2dd

Browse files
Peter XiePeter Xie
authored andcommitted
v0.8.14
1 parent 5eb1e0e commit 517f2dd

File tree

12 files changed

+193
-151
lines changed

12 files changed

+193
-151
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,22 @@ This bate version only support http & https proxy
3434

3535
Copyright (c) QTGate Systems Inc. All rights reserved.
3636

37-
Licensed under the [MIT](LICENSE) License.
37+
Licensed under the [MIT](LICENSE) License.
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:
45+
46+
The above copyright notice and this permission notice shall be included in
47+
all copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55+
THE SOFTWARE.

app/imap.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const crypto = require("crypto");
2727
const path_1 = require("path");
2828
const os_1 = require("os");
2929
const MAX_INT = 9007199254740992;
30-
const debug = false;
30+
const debug = true;
3131
const QTGateFolder = path_1.join(os_1.homedir(), '.QTGate');
3232
const ErrorLogFile = path_1.join(QTGateFolder, 'imap.log');
3333
let flag = 'w';
@@ -1065,7 +1065,6 @@ class imapPeer extends Event.EventEmitter {
10651065
this.rImap.destroyAll(null);
10661066
});
10671067
this.rImap.once('end', err => {
1068-
saveLog(`this.rImap.once end ! [${err.message}]`);
10691068
this.rImap = null;
10701069
if (!this.doingDestroy)
10711070
return this.newReadImap();

app/imap.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { join } from 'path'
2828
import { homedir }from 'os'
2929

3030
const MAX_INT = 9007199254740992
31-
const debug = false
31+
const debug = true
3232
const QTGateFolder = join ( homedir(), '.QTGate' )
3333
const ErrorLogFile = join ( QTGateFolder, 'imap.log' )
3434
let flag = 'w'
@@ -1072,10 +1072,10 @@ export class imapPeer extends Event.EventEmitter {
10721072
private mail ( email: Buffer ) {
10731073

10741074
const attr = getMailAttached ( email ).toString ()
1075+
10751076
this.deCrypto ( attr, ( err, data ) => {
10761077
if ( err )
10771078
return saveLog ( `deCrypto GOT ERROR! [${ err.message }]` )
1078-
10791079
try {
10801080
const uu = JSON.parse ( data )
10811081

@@ -1109,9 +1109,9 @@ export class imapPeer extends Event.EventEmitter {
11091109

11101110
}
11111111

1112-
private sendToRemote(text: Buffer, CallBack) {
1112+
private sendToRemote ( text: Buffer, CallBack) {
11131113
if ( this.wImap )
1114-
return this.wImap.append(text.toString('base64'), CallBack)
1114+
return this.wImap.append ( text.toString ( 'base64' ), CallBack )
11151115
}
11161116

11171117
private replyPing (uu) {
@@ -1125,7 +1125,7 @@ export class imapPeer extends Event.EventEmitter {
11251125
saveLog ( 'doing ping!' )
11261126
if ( !this.wImapReady || this.pingUuid !== null )
11271127
return saveLog ( `Ping do nothing : this.wImapReady [${ this.wImapReady }] || this.pingUuid [${ this.pingUuid }]`)
1128-
this.pingUuid = Uuid.v4()
1128+
this.pingUuid = Uuid.v4 ()
11291129
return this.enCrypto ( JSON.stringify ({ ping: this.pingUuid }), ( err, data ) => {
11301130
if ( err )
11311131
return saveLog ( `Ping enCrypto error! [${ err.message }]`)
@@ -1206,7 +1206,7 @@ export class imapPeer extends Event.EventEmitter {
12061206

12071207
})
12081208
this.rImap.once ( 'end', err => {
1209-
saveLog ( `this.rImap.once end ! [${ err.message }]` )
1209+
12101210
this.rImap = null
12111211
if ( !this.doingDestroy )
12121212
return this.newReadImap ()

app/public/scripts/home.js

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ const infoDefine = [
516516
KeypairLength: '请选择加密通讯用密钥对长度:这个数字越大,通讯越难被破解,但会增加通讯量和运算时间。',
517517
GenerateKeypair: '<em>系统正在生成用于通讯和签名的RSA加密密钥对,计算机需要运行产生大量的随机数字有,可能需要几分钟时间,尤其是长度为4096的密钥对,需要特别长的时间,请耐心等待。关于RSA加密算法的机制和原理,您可以访问维基百科:' +
518518
`<a href='https://zh.wikipedia.org/wiki/RSA加密演算法' target="_blank" onclick="return linkClick ('https://zh.wikipedia.org/wiki/RSA加密演算法')" >https://zh.wikipedia.org/wiki/RSA加密演算法</a></em>`,
519-
inputEmail: '让我们来完成设定的最后几个步骤,首先生成RSA密钥对, 它是您的系统信息加密,身份认证及和QTGate通讯使用的重要工具。 RSA密钥对的密码请妥善保存,Email地址栏应填入您的常用Email地址, 它将被用作您的QTGate账号。<em style="color:red;">需注意的是QTGate.com域名在某些网络限制地区被列入屏蔽名单,如果您使用的是网络限制地区email服务,您将不能够完成设定QTGate设定。</em>',
519+
inputEmail: '让我们来完成设定的最后几个步骤,首先生成RSA密钥对, 它是您的系统信息加密,身份认证及和QTGate通讯使用的重要工具。 RSA密钥对的密码请妥善保存,Email地址栏应填入您的常用Email地址, 它将被用作您的QTGate账号。<em style="color:red;">需注意的是QTGate.com域名在某些网络限制地区被列入屏蔽名单,如果您使用的是网络限制地区email服务,您有可能接收不到由QTGate发回的账号确认Email,以完成QTGate设定。</em>',
520520
accountEmailInfo: '由于QTGate域名在某些国家和地区被防火墙屏蔽,而不能正常收发Email,如果您是处于防火墙内的用户,建议使用防火墙外部的邮件服务商。'
521521
},
522522
Home_keyPairInfo_view: {
@@ -609,7 +609,7 @@ const infoDefine = [
609609
'通过设置PATH链接路径可以简单给您的Proxy服务器增加安全性,拒绝没有提供PATH的访问者使用您的Proxy服务器。']
610610
},
611611
useInfoMacOS: {
612-
title: '您的其他电子设备,可通过设置本地Proxy服务器,来使用QTGate连接互联网',
612+
title: '<p>本地代理服务器已在后台运行,MacOS和Windows用户可以关闭本窗口。</p>您的其他电子设备,可通过设置本地Proxy伺服器,来使用QTGate连接到互联网',
613613
title1: 'MacOS 本地代理服务器设定',
614614
proxyServerIp: '本地代理服务器地址:',
615615
proxyServerPort: '本地代理服务器端口:',
@@ -828,7 +828,7 @@ const infoDefine = [
828828
}]
829829
},
830830
useInfoMacOS: {
831-
title: '他のデバイスはローカルプロキシに設定による、QTGate利用してインターネットへアクセスができます。',
831+
title: 'ローカルプロキシサーバはバックグランドで実行しています。MacoSとWindowsユーザーはこのウィンドウを閉じても構わないです。他のデバイスはローカルプロキシに設定による、QTGate利用してインターネットへアクセスができます。',
832832
title1: 'MacOS プロキシ設定',
833833
proxyServerIp: 'プロキシサーバアドレス:',
834834
proxyServerPort: 'サーバポート:',
@@ -1079,7 +1079,7 @@ const infoDefine = [
10791079
systemAdministratorEmail: 'RSA暗号鍵ペア生成',
10801080
GenerateKeypair: '<em>強秘匿性通信するのために、RSA暗号鍵ペアを生成中、大量なランダム数字が発生し、数分かかる場合もあります、4096ビットの場合、特に時間がかかります、しばらくお待ち下さい。RSA暗号技術について、ウィキペディア百科辞典を参考してください:' +
10811081
`<a href='https://ja.wikipedia.org/wiki/RSA暗号' target="_blank" onclick="return linkClick ('https://ja.wikipedia.org/wiki/RSA暗号')">https://ja.wikipedia.org/wiki/RSA暗号</a></em>`,
1082-
inputEmail: 'お疲れ様です、最後の設定をしましょう。このRSA暗号鍵ペアは本システムに重要な存在です、ユーザーのQTGateへ身元証明、本システムデータを秘密化、QTGateシステムとデータ通信時この暗号鍵ペアを使います。パースワードはQTGateへ保存しませんですから、大事にメモしてください。<em style="color:red;">QTGateはネットワークの制限があるエリアにブラックリスト入っております、そのエリアにあるemailアカウントを使うのは遠慮してください。</em>',
1082+
inputEmail: 'お疲れ様です、最後の設定をしましょう。このRSA暗号鍵ペアは本システムに重要な存在です、ユーザーのQTGateへ身元証明、本システムデータを秘密化、QTGateシステムとデータ通信時この暗号鍵ペアを使います。パースワードはQTGateへ保存しませんですから、大事にメモしてください。<em style="color:red;">QTGateはネットワークの制限があるエリアにブラックリスト入っております、あなたはQTGateからのemailは受信不能になりますから、QTGateユーザへ登録完了することができない恐れがございます。</em>',
10831083
accountEmailInfo: 'QTGateドメイン名は、ファイヤウォールがある場合はブラックリストに入っている可能性がありますから、QTGateシステムへ登録完了することができません。その場合はファイヤウォール外側のEmailシステムを利用してください。'
10841084
},
10851085
error_message: {
@@ -1326,7 +1326,7 @@ const infoDefine = [
13261326
proxyServerIp: 'Proxy server address:',
13271327
proxyServerPort: 'Server port:',
13281328
proxyServerPassword: 'Proxy server login username and password: none',
1329-
title: 'All other devices can doing internet via local proxy setup use the QTGate system.',
1329+
title: 'Local proxy server is running at background. MacOS and windows user may close this window. All other devices can doing internet via local proxy setup use the QTGate system.',
13301330
title1: 'MacOS proxy setup',
13311331
info: [{
13321332
title: 'Open the control panel, click the network.',
@@ -1690,7 +1690,7 @@ const infoDefine = [
16901690
}]
16911691
},
16921692
useInfoMacOS: {
1693-
title: '您的其他電子設備,可通過設置本地Proxy伺服器,來使用QTGate連接到互聯網',
1693+
title: '本地代理伺服器已在後台運行,MacOS和Windows用戶可以關閉本窗口。您的其他電子設備,可通過設置本地Proxy伺服器,來使用QTGate連接到互聯網',
16941694
title1: 'MacOS 本地代理伺服器設定',
16951695
proxyServerIp: '本地代理伺服器地址:',
16961696
proxyServerPort: '本地代理伺服器端口:',
@@ -1886,7 +1886,7 @@ const infoDefine = [
18861886
systemAdministratorEmail: 'RSA密鑰生成',
18871887
GenerateKeypair: '<em>系統正在生成用於通訊和簽名的RSA加密密鑰對,計算機需要運行產生大量的隨機數字,可能需要幾分鐘時間,尤其是長度為4096的密鑰對,需要特別長的時間,請耐心等待。關於RSA加密算法的機制和原理,您可以訪問維基百科:' +
18881888
`<a href='#' target="_blank" onclick="return linkClick ('https://zh.wikipedia.org/wiki/RSA加密演算法')">https://zh.wikipedia.org/wiki/RSA加密演算法</a></em>`,
1889-
inputEmail: '让我们来完成设定的最后几个步骤,首先生成RSA密鑰對, 它是您的系統信息加密,身份認證及和QTGate通訊使用的重要工具。 RSA密鑰對的密碼請妥善保存,Email地址欄應填入您的常用Email地址, 它將被用作您的QTGate賬號。<em style="color:red;">需注意的是QTGate.com域名在某些网络限制地区被列入屏蔽名单,如果您使用的是网络限制地区email服务,您将不能够完成设定QTGate设定。</em>',
1889+
inputEmail: '让我们来完成设定的最后几个步骤,首先生成RSA密鑰對, 它是您的系統信息加密,身份認證及和QTGate通訊使用的重要工具。 RSA密鑰對的密碼請妥善保存,Email地址欄應填入您的常用Email地址, 它將被用作您的QTGate賬號。<em style="color:red;">需注意的是QTGate.com域名在某些网络限制地区被列入屏蔽名单,如果您使用的是网络限制地区email服务,您將有可能接收不到由QTGate發回的賬號確認Email,以完成QTGate設定。</em>',
18901890
accountEmailInfo: `由於QTGate域名在某些國家和地區被防火牆屏蔽,而不能正常收發QTGate的Email,如果您是處於防火牆內的用戶,建議使用防火牆外部的郵件服務商。`
18911891
},
18921892
error_message: {
@@ -2874,18 +2874,16 @@ var view_layout;
28742874
return this.MakeErrorNotify('errorKeyPair', null);
28752875
}
28762876
this.keyPair(data);
2877-
if (!this.emailPool() || !this.emailPool().length) {
2878-
this.showAddImapDataButton(false);
2879-
this.passwordError(false);
2880-
this.SystemPassword_submitRunning(false);
2881-
this.keyPair_delete_btn_view(false);
2882-
this.newKeyPairRunningCancelButtonShow(false);
2883-
this.showKeyPairPorcess(false);
2884-
this.showKeyPairInformation(true);
2885-
this.emailPool([new emailPoolData(this)]);
2886-
this.imapInputFormActive(true);
2887-
return this.MenuItems([false, false, true, false, false]);
2888-
}
2877+
this.showAddImapDataButton(false);
2878+
this.passwordError(false);
2879+
this.SystemPassword_submitRunning(false);
2880+
this.keyPair_delete_btn_view(false);
2881+
this.newKeyPairRunningCancelButtonShow(false);
2882+
this.showKeyPairPorcess(false);
2883+
this.showKeyPairInformation(true);
2884+
this.emailPool([new emailPoolData(this)]);
2885+
this.imapInputFormActive(true);
2886+
return this.MenuItems([false, false, true, false, false]);
28892887
});
28902888
socketIo.on('ImapData', (data) => {
28912889
this.imapInputFormActive(true);
@@ -3543,6 +3541,22 @@ var view_layout;
35433541
this.ConnectGatewayShow(false);
35443542
this.selectedQTGateRegionCancel();
35453543
this.disconnecting(false);
3544+
socketIo.emit('getAvaliableRegion', (region) => {
3545+
this.QTGateRegions().forEach(n => {
3546+
const index = region.findIndex(nn => { return nn === n.qtRegion; });
3547+
if (index < 0)
3548+
return n.available(false);
3549+
return n.available(true);
3550+
});
3551+
this.QTGateRegions.sort((a, b) => {
3552+
if (a.available() === b.available())
3553+
return 0;
3554+
if (b.available() && !a.available()) {
3555+
return 1;
3556+
}
3557+
return -1;
3558+
});
3559+
});
35463560
});
35473561
}
35483562
exit() {

0 commit comments

Comments
 (0)