Skip to content

Commit 78fcf16

Browse files
Peter XiePeter Xie
authored andcommitted
v1.1.0
1 parent 34fc58d commit 78fcf16

File tree

9 files changed

+158
-76
lines changed

9 files changed

+158
-76
lines changed

app/public/scripts/home.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ const infoDefine = [
585585
bottom1_1: '此致',
586586
buttom1_2: 'QTGate团队',
587587
conformButtom: '验 证',
588+
requestReturn: ['错误!您的请求被拒绝,这可能是您在短时间内多次请求所致,请稍后再试', 'QTGate系统已发送激活邮件!'],
589+
reSendRequest: '重发验证Email',
588590
formatError: [
589591
'内容格式错误,请复制从“-----BEGIN PGP MESSAGE----- (开始,一直到)-----END PGP MESSAGE-----” 结束的完整内容,粘贴在此输入框中。 ',
590592
'提供的内容不能被解密,请确认这是在您收到的最后一封从QTGate发送过来的激活信。如果还是没法完成激活,请删除您的密钥重新生成和设定。 ',
@@ -1154,6 +1156,7 @@ const infoDefine = [
11541156
},
11551157
emailConform: {
11561158
activeViewTitle: '鍵ペア検証',
1159+
requestReturn: ['エラー発生しました、それは短時間内多数の請求をしたことです。', '検証メールを発送しました。'],
11571160
info1_1: `鍵ペア検証は未完成です。QTGateは宛先 「`,
11581161
info1_2: `」 に検証メールをしました。メールボックスをチェックしてください。QTGateから多数メールの場合は、最後のを選んでください。QTGateからのメールが見つからない場合は鍵ペアを生成するメールアドレスを正しいかどうかダブチェックしてください。または鍵ペアを削除して新しい鍵ペアを再作成をしてください。`,
11591162
info2: 'コピーするのは「-----BEGIN PGP MESSAGE-----」から「-----END PGP MESSAGE-----」まで全ての内容をしてください。',
@@ -1164,6 +1167,7 @@ const infoDefine = [
11641167
bottom1_1: '以上',
11651168
bottom1_2: 'QTGateチームより',
11661169
conformButtom: '検 証',
1170+
reSendRequest: '検証Emailを再発行',
11671171
formatError: [
11681172
'フォーマットエラー、コピーするのは「-----BEGIN PGP MESSAGE-----」から「-----END PGP MESSAGE-----」まで全ての内容をしてください。',
11691173
'この内容で暗号化解除ができませんでした。鍵ペアEmailアカンウトメールボックス再検査し、QTGateから最後のを選んでください。または鍵ペアを削除して、鍵ペア再発行してください。',
@@ -1637,7 +1641,9 @@ const infoDefine = [
16371641
emailDetail2: 'This is your secret verification code to validate your QTGate account. Please copy and paste all the content in the text area.',
16381642
bottom1_1: 'Best regards,',
16391643
bottom1_2: 'The QTGate team',
1644+
requestReturn: ['ERROR! QTGate system refuse your request, may be you did request repeatedly, please try again late.', 'Verification mail has been sent.'],
16401645
conformButtom: 'Conform',
1646+
reSendRequest: 'Request another verification email',
16411647
formatError: [
16421648
'Format error! Copy all content from [-----BEGIN PGP MESSAGE-----] ... to [-----END PGP MESSAGE-----]. Paste into this text box.',
16431649
'Oops. Find the lasest mail from QTGate in your key pair email mailbox. Or delete this key pair and rebuild new key pair please.',
@@ -2084,6 +2090,8 @@ const infoDefine = [
20842090
info2: '複制內容從“-----BEGIN PGP MESSAGE----- ( 開始,一直到 )----- END PGP MESSAGE-----” 結束的完整內容,粘貼到此輸入框中',
20852091
emailDetail1: '尊敬的 ',
20862092
emailDetail1_1: '',
2093+
reSendRequest: '再次發送驗證Email',
2094+
requestReturn: ['錯誤!您的請求被拒絕,這可能是您在短時間內多次請求所致,請稍後再試', 'QTGate系統已發送激活郵件!'],
20872095
emailDetail2: '這是您的QTGate帳號激活密碼,請複制下列框內的全部內容:',
20882096
bottom1_1: '此致',
20892097
bottom1_2: 'QTGate團隊',
@@ -3121,6 +3129,8 @@ var view_layout;
31213129
const index = this.emailPool().findIndex(n => { return availableImapServer.test(n.iMapServerName()); });
31223130
return index > -1;
31233131
});
3132+
this.requestActivEmailrunning = ko.observable(false);
3133+
this.showSentActivEmail = ko.observable(-1);
31243134
this.QTGateLocalProxyPort.subscribe(newValue => {
31253135
this.localProxyPortError(false);
31263136
const num = parseInt(newValue.toString());
@@ -3334,9 +3344,7 @@ var view_layout;
33343344
this.showActiveMail(false);
33353345
if (data.qtGateConnecting === 2) {
33363346
return setTimeout(() => {
3337-
return socketIo.emit('getAvaliableRegion', (region, dataTransfer, config) => {
3338-
return this.getAvaliableRegionCallBack(region, dataTransfer, config);
3339-
});
3347+
return this.getAvaliableRegion();
33403348
}, 2000);
33413349
}
33423350
const process = $('#connectImformationProcess');
@@ -4044,6 +4052,17 @@ var view_layout;
40444052
event.preventDefault();
40454053
shell.openExternal(url);
40464054
}
4055+
requestActivEmail() {
4056+
this.requestActivEmailrunning(true);
4057+
this.showSentActivEmail(-1);
4058+
return socketIo.emit('requestActivEmail', CallBack => {
4059+
this.requestActivEmailrunning(false);
4060+
if (CallBack < 0) {
4061+
return this.showSentActivEmail(1);
4062+
}
4063+
return this.showSentActivEmail(CallBack);
4064+
});
4065+
}
40474066
}
40484067
view_layout.view = view;
40494068
})(view_layout || (view_layout = {}));

app/public/scripts/home.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,8 @@ const infoDefine = [
640640
bottom1_1: '此致',
641641
buttom1_2: 'QTGate团队',
642642
conformButtom: '验 证',
643+
requestReturn: ['错误!您的请求被拒绝,这可能是您在短时间内多次请求所致,请稍后再试','QTGate系统已发送激活邮件!'],
644+
reSendRequest:'重发验证Email',
643645
formatError: [
644646
'内容格式错误,请复制从“-----BEGIN PGP MESSAGE----- (开始,一直到)-----END PGP MESSAGE-----” 结束的完整内容,粘贴在此输入框中。 ',
645647
'提供的内容不能被解密,请确认这是在您收到的最后一封从QTGate发送过来的激活信。如果还是没法完成激活,请删除您的密钥重新生成和设定。 ',
@@ -1237,6 +1239,7 @@ const infoDefine = [
12371239

12381240
emailConform: {
12391241
activeViewTitle:'鍵ペア検証',
1242+
requestReturn: ['エラー発生しました、それは短時間内多数の請求をしたことです。','検証メールを発送しました。'],
12401243
info1_1:`鍵ペア検証は未完成です。QTGateは宛先 「`,
12411244
info1_2: `」 に検証メールをしました。メールボックスをチェックしてください。QTGateから多数メールの場合は、最後のを選んでください。QTGateからのメールが見つからない場合は鍵ペアを生成するメールアドレスを正しいかどうかダブチェックしてください。または鍵ペアを削除して新しい鍵ペアを再作成をしてください。`,
12421245
info2: 'コピーするのは「-----BEGIN PGP MESSAGE-----」から「-----END PGP MESSAGE-----」まで全ての内容をしてください。',
@@ -1247,6 +1250,7 @@ const infoDefine = [
12471250
bottom1_1: '以上',
12481251
bottom1_2: 'QTGateチームより',
12491252
conformButtom: '検 証',
1253+
reSendRequest:'検証Emailを再発行',
12501254
formatError: [
12511255
'フォーマットエラー、コピーするのは「-----BEGIN PGP MESSAGE-----」から「-----END PGP MESSAGE-----」まで全ての内容をしてください。',
12521256
'この内容で暗号化解除ができませんでした。鍵ペアEmailアカンウトメールボックス再検査し、QTGateから最後のを選んでください。または鍵ペアを削除して、鍵ペア再発行してください。',
@@ -1754,7 +1758,9 @@ const infoDefine = [
17541758
emailDetail2: 'This is your secret verification code to validate your QTGate account. Please copy and paste all the content in the text area.',
17551759
bottom1_1: 'Best regards,',
17561760
bottom1_2: 'The QTGate team',
1761+
requestReturn: ['ERROR! QTGate system refuse your request, may be you did request repeatedly, please try again late.','Verification mail has been sent.'],
17571762
conformButtom: 'Conform',
1763+
reSendRequest:'Request another verification email',
17581764
formatError: [
17591765
'Format error! Copy all content from [-----BEGIN PGP MESSAGE-----] ... to [-----END PGP MESSAGE-----]. Paste into this text box.',
17601766
'Oops. Find the lasest mail from QTGate in your key pair email mailbox. Or delete this key pair and rebuild new key pair please.',
@@ -1861,7 +1867,7 @@ const infoDefine = [
18611867
MonthBandwidthTitle:'月度可使用代理伺服器數據傳送限額:',
18621868
dayBandwidthTitle:'每日限額:',
18631869
upgradeTitle:'升級賬戶選項',
1864-
            DowngradeTitle:'降級賬戶選項',
1870+
DowngradeTitle:'降級賬戶選項',
18651871
cancelPlan:'終止當前月租',
18661872
MonthBandwidthTitle1:'傳送限額',
18671873
serverShare:'代理伺服器',
@@ -1872,7 +1878,6 @@ const infoDefine = [
18721878
serverShareData1:'使用同時鏈接多台代理技術,使用台數大於獨占數時,會相應分享您所獨占的資源',
18731879
maxmultigateway: ['最大同時可二條並發代理','最大同時可四條並發代理'],
18741880
cancelPlanMessage:'QTGate的訂閱是以月為基本的單位。您的月訂閱將在下月您的訂閱起始日前被終止,您可以繼續使用您的本月訂閱計劃,您將自動回到免費用戶。如果您是每月自動扣款,則下月將不再扣款。如果您是年度訂閱計劃,您的退款將按普通每月訂閱費,扣除您已經使用的月份後計算的差額,將自動返還您所支付的信用卡賬號,如果您是使用促銷碼,或您是測試用戶,您的終止訂閱將不能被接受。 '
1875-
18761881
},
18771882
QTGateDonate: {
18781883
title: 'QTGate贊助商提供的免流量網站',
@@ -2227,6 +2232,8 @@ const infoDefine = [
22272232
info2: '複制內容從“-----BEGIN PGP MESSAGE----- ( 開始,一直到 )----- END PGP MESSAGE-----” 結束的完整內容,粘貼到此輸入框中',
22282233
emailDetail1: '尊敬的 ',
22292234
emailDetail1_1: '',
2235+
reSendRequest:'再次發送驗證Email',
2236+
requestReturn: ['錯誤!您的請求被拒絕,這可能是您在短時間內多次請求所致,請稍後再試','QTGate系統已發送激活郵件!'],
22302237
emailDetail2: '這是您的QTGate帳號激活密碼,請複制下列框內的全部內容:',
22312238
bottom1_1:'此致',
22322239
bottom1_2:'QTGate團隊',
@@ -3517,9 +3524,7 @@ module view_layout {
35173524
this.showActiveMail( false )
35183525
if ( data.qtGateConnecting === 2 ) {
35193526
return setTimeout (() => {
3520-
return socketIo.emit ( 'getAvaliableRegion', ( region: string [], dataTransfer: iTransferData, config: install_config ) => {
3521-
return this.getAvaliableRegionCallBack ( region, dataTransfer, config )
3522-
})
3527+
return this.getAvaliableRegion ()
35233528
}, 2000 )
35243529
}
35253530
const process = $ ( '#connectImformationProcess' )
@@ -4303,7 +4308,7 @@ module view_layout {
43034308
}
43044309

43054310
public downloadCheck () {
4306-
return socketIo.emit ( 'downloadCheck')
4311+
return socketIo.emit ( 'downloadCheck')
43074312
}
43084313

43094314
public pingCheckReturn ( region: string, ping: number ) {
@@ -4434,6 +4439,19 @@ module view_layout {
44344439
const index = this.emailPool ().findIndex ( n => { return availableImapServer.test ( n.iMapServerName()) })
44354440
return index > -1
44364441
})
4442+
public requestActivEmailrunning = ko.observable ( false )
4443+
public showSentActivEmail = ko.observable (-1)
4444+
public requestActivEmail () {
4445+
this.requestActivEmailrunning ( true )
4446+
this.showSentActivEmail (-1)
4447+
return socketIo.emit ( 'requestActivEmail', CallBack => {
4448+
this.requestActivEmailrunning ( false )
4449+
if ( CallBack < 0 ){
4450+
return this.showSentActivEmail (1)
4451+
}
4452+
return this.showSentActivEmail (CallBack)
4453+
})
4454+
}
44374455

44384456
}
44394457

app/server.js

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -672,40 +672,50 @@ class localServer {
672672
this.regionV1 = res.Args[2];
673673
});
674674
});
675+
socket.on('requestActivEmail', CallBack => {
676+
if (this.config.keypair.verified)
677+
return CallBack(0);
678+
const com = {
679+
command: 'requestActivEmail',
680+
Args: [],
681+
error: null,
682+
requestSerial: Crypto1.randomBytes(8).toString('hex')
683+
};
684+
return this.QTClass.request(com, (err, res) => {
685+
return CallBack(res.error);
686+
});
687+
});
675688
socket.once('exit', () => {
676689
remote.app.exit();
677690
});
678691
socket.on('pingCheck', CallBack => {
679692
if (process.platform === 'linux')
680693
return CallBack(-1);
681-
/*
682-
saveLog (`socket.on ( 'pingCheck' )`)
683-
if ( !this.regionV1 || this.pingChecking ) {
684-
saveLog (`!this.regionV1 [${ !this.regionV1 }] || this.pingChecking [${ this.pingChecking }]`)
685-
return CallBack()
694+
saveLog(`socket.on ( 'pingCheck' )`);
695+
if (!this.regionV1 || this.pingChecking) {
696+
saveLog(`!this.regionV1 [${!this.regionV1}] || this.pingChecking [${this.pingChecking}]`);
697+
return CallBack();
686698
}
687-
688-
this.pingChecking = true
699+
this.pingChecking = true;
689700
try {
690-
const netPing = require ('net-ping')
691-
const session = netPing.createSession ()
692-
} catch (ex) {
693-
console.log (`netPing.createSession err`, ex )
694-
return CallBack ( -1 )
701+
const netPing = require('net-ping');
702+
const session = netPing.createSession();
703+
}
704+
catch (ex) {
705+
console.log(`netPing.createSession err`, ex);
706+
return CallBack(-1);
695707
}
696-
Async.eachSeries ( this.regionV1, ( n: regionV1, next ) => {
697-
698-
return testPing ( n.testHostIp, ( err, ping ) => {
699-
saveLog( `testPing [${ n.regionName }] return ping [${ ping }]`)
700-
socket.emit ( 'pingCheck', n.regionName, err? 9999: ping )
701-
return next ()
702-
})
708+
Async.eachSeries(this.regionV1, (n, next) => {
709+
return testPing(n.testHostIp, (err, ping) => {
710+
saveLog(`testPing [${n.regionName}] return ping [${ping}]`);
711+
socket.emit('pingCheck', n.regionName, err ? 9999 : ping);
712+
return next();
713+
});
703714
}, () => {
704-
saveLog (`pingCheck success!`)
705-
this.pingChecking = false
706-
return CallBack ()
707-
})
708-
*/
715+
saveLog(`pingCheck success!`);
716+
this.pingChecking = false;
717+
return CallBack();
718+
});
709719
});
710720
socket.once('downloadCheck', CallBack => {
711721
if (!this.regionV1)
@@ -1737,36 +1747,31 @@ class ImapConnect extends Imap.imapPeer {
17371747
return this.doReady(socket, () => { });
17381748
}
17391749
}
1740-
/*
1741-
const testPing = ( hostIp: string, CallBack ) => {
1742-
let pingTime = 0
1743-
const test = new Array ( testPingTimes )
1744-
test.fill ( hostIp )
1745-
saveLog (`start testPing [${ hostIp }]`)
1746-
return Async.eachSeries ( test, ( n, next ) => {
1747-
const netPing = require ('net-ping')
1748-
const session = netPing.createSession ()
1749-
session.pingHost ( hostIp, ( err, target, sent, rcvd ) => {
1750-
1751-
session.close ()
1752-
if ( err ) {
1753-
saveLog (`session.pingHost ERROR, ${ err.message }`)
1754-
return next ( err )
1750+
const testPing = (hostIp, CallBack) => {
1751+
let pingTime = 0;
1752+
const test = new Array(testPingTimes);
1753+
test.fill(hostIp);
1754+
saveLog(`start testPing [${hostIp}]`);
1755+
return Async.eachSeries(test, (n, next) => {
1756+
const netPing = require('net-ping');
1757+
const session = netPing.createSession();
1758+
session.pingHost(hostIp, (err, target, sent, rcvd) => {
1759+
session.close();
1760+
if (err) {
1761+
saveLog(`session.pingHost ERROR, ${err.message}`);
1762+
return next(err);
17551763
}
1756-
const ping = rcvd.getTime () - sent.getTime ()
1757-
pingTime += ping
1758-
return next ()
1759-
})
1764+
const ping = rcvd.getTime() - sent.getTime();
1765+
pingTime += ping;
1766+
return next();
1767+
});
17601768
}, err => {
1761-
if ( err ) {
1762-
return CallBack ( new Error ('ping error'))
1769+
if (err) {
1770+
return CallBack(new Error('ping error'));
17631771
}
1764-
1765-
return CallBack ( null, Math.round ( pingTime/testPingTimes ))
1766-
})
1767-
1768-
}
1769-
*/
1772+
return CallBack(null, Math.round(pingTime / testPingTimes));
1773+
});
1774+
};
17701775
const makeFeedBackDataToQTGateAPIRequestCommand = (data, Callback) => {
17711776
const ret = {
17721777
command: 'feedBackData',

app/server.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,29 @@ export class localServer {
713713
})
714714
})
715715

716+
socket.on ( 'requestActivEmail', CallBack => {
717+
if ( this.config.keypair.verified )
718+
return CallBack (0)
719+
720+
const com: QTGateAPIRequestCommand = {
721+
command: 'requestActivEmail',
722+
Args: [],
723+
error: null,
724+
requestSerial: Crypto1.randomBytes(8).toString('hex')
725+
}
726+
return this.QTClass.request ( com, ( err: number, res: QTGateAPIRequestCommand ) => {
727+
return CallBack (res.error)
728+
})
729+
})
730+
716731
socket.once ( 'exit', () => {
717732
remote.app.exit()
718733
})
719734

720735
socket.on ( 'pingCheck', CallBack => {
721736
if ( process.platform === 'linux')
722737
return CallBack ( -1 )
723-
/*
738+
724739
saveLog (`socket.on ( 'pingCheck' )`)
725740
if ( !this.regionV1 || this.pingChecking ) {
726741
saveLog (`!this.regionV1 [${ !this.regionV1 }] || this.pingChecking [${ this.pingChecking }]`)
@@ -747,7 +762,7 @@ export class localServer {
747762
this.pingChecking = false
748763
return CallBack ()
749764
})
750-
*/
765+
751766
})
752767

753768

@@ -2025,7 +2040,7 @@ class ImapConnect extends Imap.imapPeer {
20252040
}
20262041

20272042
}
2028-
/*
2043+
20292044
const testPing = ( hostIp: string, CallBack ) => {
20302045
let pingTime = 0
20312046
const test = new Array ( testPingTimes )
@@ -2054,7 +2069,7 @@ const testPing = ( hostIp: string, CallBack ) => {
20542069
})
20552070

20562071
}
2057-
*/
2072+
20582073
const makeFeedBackDataToQTGateAPIRequestCommand = ( data: feedBackData, Callback ) => {
20592074
const ret: QTGateAPIRequestCommand = {
20602075
command: 'feedBackData',

0 commit comments

Comments
 (0)