Skip to content

Commit 7517e0f

Browse files
peterpeter
peter
authored and
peter
committed
v2.0.11
1 parent e6c2446 commit 7517e0f

26 files changed

+353
-282
lines changed

app/CoNET.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,12 @@ interface twitter_mediaData {
476476
}
477477

478478
interface twitter_postData {
479-
text: string,
480-
images: string[],
479+
text: string
480+
images: string[]
481481
media_data: twitter_mediaData[]
482482
videoSize: number
483483
videoFileName: string
484+
uuid: string
484485
}
485486

486487

app/localWebServer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class localServer {
262262
return this.CoNETConnectCalss.requestCoNET(cmd, (err, res) => {
263263
saveLog(`request response [${cmd.command}]`);
264264
if (err) {
265-
this.socketServer.emit('CoNET_offline');
265+
CallBack(err);
266266
return saveLog(`QTClass.request error! [${err}]`);
267267
}
268268
return CallBack(null, res);
@@ -469,7 +469,6 @@ class localServer {
469469
Args: [],
470470
error: null
471471
};
472-
console.log(`socket.on ( 'getAvaliableRegion') no this.connectCommand`);
473472
return this.sendRequest(socket, com, (err, res) => {
474473
if (err) {
475474
return saveLog(`getAvaliableRegion QTClass.request callback error! STOP [${err}]`);
@@ -913,6 +912,7 @@ class localServer {
913912
error: null,
914913
requestSerial: Crypto.randomBytes(10).toString('hex')
915914
};
915+
console.log(`[twitter_post]\n${Util.inspect(postData)}`);
916916
/*
917917
Imap.imapGetMediaFilesFromString ( this.localServer.QTClass.imapData, postData.videoFileName, QTGateVideo, ( err1, data ) => {
918918
if ( err1 ) {
@@ -1013,6 +1013,7 @@ class localServer {
10131013
if (!account || !postData.length) {
10141014
return console.log('on twitter_postNewTweet but format error!');
10151015
}
1016+
console.log(Util.inspect(postData, false, 4, true));
10161017
return this.postTweetViaQTGate(socket, account, postData[0], (err, res) => {
10171018
if (res.Args && res.Args.length > 0) {
10181019
let uu = null;
@@ -1026,7 +1027,9 @@ class localServer {
10261027
uu.user.profile_image_url_https = this.twitterData[this.currentTwitterAccount].twitter_verify_credentials.profile_image_url_https;
10271028
return socket.emit('getTimelines', uu, true);
10281029
}
1029-
return socket.emit('twitter_postNewTweet', err);
1030+
if (err) {
1031+
return socket.emit('twitter_postNewTweet', err);
1032+
}
10301033
});
10311034
});
10321035
socket.on('getTwitterTextLength', (twitterText, CallBack1) => {

app/localWebServer.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ export default class localServer {
228228

229229
cmd.requestSerial = Crypto.randomBytes(8).toString('hex')
230230

231-
return this.CoNETConnectCalss.requestCoNET ( cmd, ( err: number, res: QTGateAPIRequestCommand ) => {
232-
saveLog (`request response [${ cmd.command }]`)
231+
return this.CoNETConnectCalss.requestCoNET ( cmd, ( err, res: QTGateAPIRequestCommand ) => {
232+
saveLog ( `request response [${ cmd.command }]`)
233233
if ( err ) {
234-
this.socketServer.emit ('CoNET_offline')
234+
CallBack ( err )
235235
return saveLog ( `QTClass.request error! [${ err }]`)
236236
}
237237
return CallBack ( null, res )
@@ -491,8 +491,6 @@ export default class localServer {
491491
error: null
492492
}
493493

494-
console.log (`socket.on ( 'getAvaliableRegion') no this.connectCommand`)
495-
496494
return this.sendRequest ( socket, com, ( err: number, res: QTGateAPIRequestCommand ) => {
497495
if ( err ) {
498496
return saveLog ( `getAvaliableRegion QTClass.request callback error! STOP [${ err }]`)
@@ -994,6 +992,7 @@ export default class localServer {
994992
}
995993

996994
private postTweetViaQTGate ( socket, account: TwitterAccount, postData: twitter_postData, Callback ) {
995+
997996
const post = err => {
998997
if ( err ) {
999998
saveLog ( `postTweetViaQTGate post got error: [${ err.message }] `)
@@ -1008,6 +1007,7 @@ export default class localServer {
10081007
error: null,
10091008
requestSerial: Crypto.randomBytes( 10 ).toString ( 'hex' )
10101009
}
1010+
console.log (`[twitter_post]\n${ Util.inspect ( postData )}`)
10111011
/*
10121012
Imap.imapGetMediaFilesFromString ( this.localServer.QTClass.imapData, postData.videoFileName, QTGateVideo, ( err1, data ) => {
10131013
if ( err1 ) {
@@ -1129,9 +1129,9 @@ export default class localServer {
11291129
socket.on ( 'twitter_postNewTweet', ( account: TwitterAccount, postData: twitter_postData[], CallBack1 ) => {
11301130
CallBack1 ()
11311131
if ( !account || !postData.length ) {
1132-
return console.log ('on twitter_postNewTweet but format error!')
1132+
return console.log ( 'on twitter_postNewTweet but format error!' )
11331133
}
1134-
1134+
console.log ( Util.inspect ( postData, false, 4, true ))
11351135

11361136
return this.postTweetViaQTGate ( socket, account, postData[0], ( err, res ) => {
11371137
if ( res.Args && res.Args.length > 0 ) {
@@ -1146,7 +1146,10 @@ export default class localServer {
11461146
uu.user.profile_image_url_https = this.twitterData[this.currentTwitterAccount].twitter_verify_credentials.profile_image_url_https
11471147
return socket.emit ( 'getTimelines', uu, true )
11481148
}
1149-
return socket.emit ( 'twitter_postNewTweet', err )
1149+
if ( err ) {
1150+
return socket.emit ( 'twitter_postNewTweet', err )
1151+
}
1152+
11501153
})
11511154
})
11521155

app/public/css/semantic.min.css

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/scripts/Cleave.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/scripts/home.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,18 @@ var view_layout;
437437
let uu = null;
438438
this.imapData = _imapData;
439439
return this.CoNETConnect(uu = new CoNETConnect(_imapData.imapUserName, this.keyPair().verified, _imapData.confirmRisk, this.keyPair().email, function ConnectReady(err, showCoGate) {
440-
if (err) {
441-
self.CoNETConnect(uu = null);
442-
return self.imapSetup(uu = new imapForm(_imapData.account, null, function (imapData) {
443-
self.imapSetup(uu = null);
444-
return self.imapSetupClassExit(imapData);
445-
}));
440+
if (typeof err === 'number' && err > -1) {
441+
let coGate = self.CoGateClass(null);
442+
coGate = null;
443+
self.CoGateClass();
444+
if (showCoGate) {
445+
self.CoNETConnect(uu = null);
446+
return self.imapSetup(uu = new imapForm(_imapData.account, null, function (imapData) {
447+
self.imapSetup(uu = null);
448+
return self.imapSetupClassExit(imapData);
449+
}));
450+
}
451+
return;
446452
}
447453
this.connectedCoNET(true);
448454
//self.showCoGate ( showCoGate )

app/public/scripts/home.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ module view_layout {
410410
self.CoGateRegionStoped ( true )
411411

412412
})
413+
413414

414415

415416
socketIo.emit11 ( 'init' )
@@ -508,12 +509,20 @@ module view_layout {
508509
this.imapData = _imapData
509510
return this.CoNETConnect ( uu = new CoNETConnect ( _imapData.imapUserName, this.keyPair().verified, _imapData.confirmRisk, this.keyPair().email,
510511
function ConnectReady ( err, showCoGate ) {
511-
if ( err ) {
512-
self.CoNETConnect ( uu = null )
513-
return self.imapSetup ( uu = new imapForm ( _imapData.account, null, function ( imapData: IinputData ) {
514-
self.imapSetup ( uu = null )
515-
return self.imapSetupClassExit ( imapData )
516-
}))
512+
if ( typeof err ==='number' && err > -1 ) {
513+
514+
let coGate = self.CoGateClass (null)
515+
coGate = null
516+
self.CoGateClass ()
517+
if ( showCoGate ) {
518+
self.CoNETConnect ( uu = null )
519+
return self.imapSetup ( uu = new imapForm ( _imapData.account, null, function ( imapData: IinputData ) {
520+
self.imapSetup ( uu = null )
521+
return self.imapSetupClassExit ( imapData )
522+
}))
523+
}
524+
return
525+
517526
}
518527
this.connectedCoNET ( true )
519528
//self.showCoGate ( showCoGate )

app/public/scripts/imapForm.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ class CoNETConnect {
239239
const self = this;
240240
this.showConnectCoNETProcess(true);
241241
let processBarCount = 0;
242-
if (err !== null && err > -1) {
242+
if (typeof err === 'number' && err > -1) {
243243
this.connectStage(-1);
244+
this.ready(err, false);
244245
return this.connetcError(err);
245246
}
246247
if (stage === 4) {
@@ -268,7 +269,7 @@ class CoNETConnect {
268269
return this.connectStage(stage);
269270
}
270271
returnToImapSetup() {
271-
return this.ready(true);
272+
return this.ready(0, true);
272273
}
273274
imapConform() {
274275
const self = this;

app/public/scripts/imapForm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ class CoNETConnect {
262262
const self = this
263263
this.showConnectCoNETProcess ( true )
264264
let processBarCount = 0
265-
if ( err !== null && err > -1 ) {
265+
if ( typeof err === 'number' && err > -1 ) {
266266
this.connectStage ( -1 )
267+
this.ready ( err, false )
267268
return this.connetcError ( err )
268269
}
269270

@@ -297,7 +298,7 @@ class CoNETConnect {
297298
}
298299

299300
public returnToImapSetup () {
300-
return this.ready ( true )
301+
return this.ready ( 0, true )
301302
}
302303

303304
public imapConform () {

0 commit comments

Comments
 (0)