Skip to content

Commit b6aba5e

Browse files
peterpeter
authored andcommitted
v1.2.5
1 parent c399ef2 commit b6aba5e

5 files changed

Lines changed: 15 additions & 31 deletions

File tree

app/proxyServer.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,13 @@ export class proxyServer {
458458

459459
}
460460

461-
public changeDocker ( data: IConnectCommand[] ) {
461+
public changeDocker ( data: IConnectCommand ) {
462462

463-
this.multipleGateway = data
464-
this.gateway = new gateWay ( this.multipleGateway )
465-
saveLog (`changeDocker [${ JSON.stringify ( this.multipleGateway )}]`)
463+
const index = this.multipleGateway.findIndex ( n => { return n.containerUUID === data.containerUUID })
464+
if ( index < 0 ) {
465+
return saveLog (`on changeDocker [${ data.containerUUID }] but can't find this uuid`)
466+
}
467+
this.multipleGateway [ index ]= data
466468
}
467469

468470
}
@@ -492,7 +494,7 @@ remote.getCurrentWindow().once ( 'firstCallBack', ( data: IConnectCommand[] ) =>
492494
server = new proxyServer ( [], new Map(), data[0].localServerIp, data[0].localServerPort, 'pac', 5000, data, 50000, data[0].AllDataToGateway|| true, [] )
493495
})
494496

495-
remote.getCurrentWindow().on( 'changeDocker', ( data: IConnectCommand[] ) => {
497+
remote.getCurrentWindow().on( 'changeDocker', ( data: IConnectCommand ) => {
496498
saveLog ( `got changeDocker event! data [${ JSON.stringify ( data )}]`)
497499
server.changeDocker ( data )
498500
})

app/server.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ class localServer {
679679
const arg = this.connectCommand = res.Args[1];
680680
arg.forEach(n => {
681681
n.localServerIp = exports.getLocalInterface()[0];
682-
n.localServerPort = this.localProxyPort || 3000;
683682
});
684683
this.makeOpnConnect(arg);
685684
}
@@ -909,7 +908,6 @@ class localServer {
909908
const arg = this.connectCommand = res.Args;
910909
arg.forEach(n => {
911910
n.localServerIp = exports.getLocalInterface()[0];
912-
n.localServerPort = n.localServerPort || this.localProxyPort || 3001;
913911
});
914912
this.makeOpnConnect(arg);
915913
}
@@ -1406,8 +1404,8 @@ class localServer {
14061404
const transporter = Nodemailer.createTransport(option);
14071405
const mailOptions = {
14081406
from: imapData.email,
1409-
to: 'QTGateTest@QTGate.com',
1410-
subject: 'QTGateTest',
1407+
to: 'QTGate@QTGate.com',
1408+
subject: 'QTGate',
14111409
attachments: [{
14121410
content: text
14131411
}]
@@ -1746,18 +1744,12 @@ class ImapConnect extends Imap.imapPeer {
17461744
return localServer.disConnectGateway();
17471745
}
17481746
case 'changeDocker': {
1749-
const container = ret.Args;
1750-
saveLog(`QTGateAPIRequestCommand changeDocker container = [${JSON.stringify(container)}]`);
1747+
const container = ret.Args[0];
17511748
if (!container) {
17521749
return saveLog(`got Command from server "changeDocker" but have no data ret = [${JSON.stringify(ret)}]`);
17531750
}
17541751
if (!this.localServer.proxyServer || !this.localServer.connectCommand) {
1755-
saveLog(`got Command from server "changeDocker" localServer.proxyServer or localServer.connectCommand is null!!`);
1756-
return findPort(this.localServer.localProxyPort, (err, port) => {
1757-
container[0].localServerPort = this.localServer.localProxyPort = port;
1758-
container[0].localServerIp = exports.getLocalInterface()[0];
1759-
return this.localServer.makeOpnConnect(container);
1760-
});
1752+
return saveLog(`got Command from server "changeDocker" localServer.proxyServer or localServer.connectCommand is null!!`);
17611753
}
17621754
return this.localServer.proxyServer.sendCommand('changeDocker', container);
17631755
}

app/server.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ export class localServer {
722722
const arg: IConnectCommand[] = this.connectCommand = res.Args[1]
723723
arg.forEach ( n => {
724724
n.localServerIp = getLocalInterface ()[0]
725-
n.localServerPort = this.localProxyPort || 3000
726725
})
727726
this.makeOpnConnect ( arg )
728727
}
@@ -988,7 +987,6 @@ export class localServer {
988987
const arg: IConnectCommand[] = this.connectCommand = res.Args
989988
arg.forEach ( n => {
990989
n.localServerIp = getLocalInterface ()[0]
991-
n.localServerPort = n.localServerPort || this.localProxyPort || 3001
992990
})
993991

994992
this.makeOpnConnect ( arg )
@@ -2132,21 +2130,13 @@ class ImapConnect extends Imap.imapPeer {
21322130

21332131
case 'changeDocker' : {
21342132

2135-
const container: IConnectCommand[] = ret.Args
2136-
saveLog ( `QTGateAPIRequestCommand changeDocker container = [${ JSON.stringify ( container )}]`)
2133+
const container: IConnectCommand = ret.Args[0]
21372134
if ( ! container ) {
21382135
return saveLog ( `got Command from server "changeDocker" but have no data ret = [${ JSON.stringify ( ret )}]`)
21392136
}
21402137

21412138
if ( ! this.localServer.proxyServer || ! this.localServer.connectCommand ) {
2142-
saveLog ( `got Command from server "changeDocker" localServer.proxyServer or localServer.connectCommand is null!!`)
2143-
2144-
return findPort ( this.localServer.localProxyPort, ( err, port ) => {
2145-
container[0].localServerPort = this.localServer.localProxyPort = port
2146-
container[0].localServerIp = getLocalInterface ()[0]
2147-
return this.localServer.makeOpnConnect ( container )
2148-
2149-
})
2139+
return saveLog ( `got Command from server "changeDocker" localServer.proxyServer or localServer.connectCommand is null!!`)
21502140

21512141
}
21522142
return this.localServer.proxyServer.sendCommand ( 'changeDocker', container )

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
Object.defineProperty(exports, "__esModule", { value: true });
19-
const DEBUG = true;
19+
const DEBUG = false;
2020
const Fs = require("fs");
2121
const Os = require("os");
2222
const path_1 = require("path");

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
const DEBUG = true
18+
const DEBUG = false
1919

2020
import * as Fs from 'fs'
2121
import * as Os from 'os'

0 commit comments

Comments
 (0)