Skip to content

Commit

Permalink
v0.8.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Xie authored and Peter Xie committed Oct 14, 2017
1 parent 6de3e11 commit 8e94bcf
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 1,528 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ os:

before_install:
- nvm install 8.7.0
- nvm use 8.7.0
- nvm use 8.7.0
- npm i electron-builder
10 changes: 6 additions & 4 deletions app/imap.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,12 @@ class qtGateImap extends Event.EventEmitter {
this.port = parseInt(this.IMapConnect.imapPortNumber);
this.connectTimeOut = null;
this.connect();
process.once('uncaughtException', err => {
console.log(err);
this.destroyAll(err);
});
/*
process.once ( 'uncaughtException', err => {
console.log ( err )
this.destroyAll ( err )
})
*/
}
get TagCount() {
if (++this.tagcount < MAX_INT)
Expand Down
2 changes: 2 additions & 0 deletions app/imap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,12 @@ export class qtGateImap extends Event.EventEmitter {
constructor ( public IMapConnect: imapConnect, public listenFolder: string, private isEachMail: boolean, public deleteBoxWhenEnd: boolean, public writeFolder: string, private debug: boolean, public newMail: ( mail ) => void ) {
super ()
this.connect ()
/*
process.once ( 'uncaughtException', err => {
console.log ( err )
this.destroyAll ( err )
})
*/
}

public destroyAll ( err: Error ) {
Expand Down
2 changes: 1 addition & 1 deletion app/public/scripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,7 @@ var view_layout;
const text = this.conformText();
if (!text.length)
return;
const check = /^-----BEGIN PGP MESSAGE-----(\r)?\n(.+)((\r)?\n)/.test(text) && /(\r)?\n-----END PGP MESSAGE-----((\r)?\n)?/.test(text);
const check = /^-----BEGIN PGP MESSAGE-----/.test(text);
this.conformTextErrorNumber(0);
if (!check) {
this.conformTextError(true);
Expand Down
2 changes: 1 addition & 1 deletion app/public/scripts/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3693,7 +3693,7 @@ module view_layout {
const text = this.conformText ()
if ( ! text.length )
return
const check = /^-----BEGIN PGP MESSAGE-----(\r)?\n(.+)((\r)?\n)/.test ( text ) && /(\r)?\n-----END PGP MESSAGE-----((\r)?\n)?/.test ( text )
const check = /^-----BEGIN PGP MESSAGE-----/.test ( text )
this.conformTextErrorNumber ( 0 )
if ( ! check ) {
this.conformTextError ( true )
Expand Down
10 changes: 7 additions & 3 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ class localServer {
this.bufferPassword = data.toString('hex');
options.message = openpgp.message.readArmored(text);
openpgp.decrypt(options).then(plaintext => {
console.log(`openpgp.decrypt success!`, plaintext);
try {
const data = JSON.parse(plaintext.data);
return next(null, data);
Expand All @@ -500,6 +501,7 @@ class localServer {
return next(new Error('readImapData try SON.parse ( plaintext.data ) catch ERROR:' + e.message));
}
}).catch(err => {
console.log(`openpgp.decrypt ERROR: `, err);
next(err);
});
}
Expand Down Expand Up @@ -645,10 +647,12 @@ class localServer {
});
});
socket.on('checkActiveEmailSubmit', (text) => {
if (!text || !text.length || !/^-----BEGIN PGP MESSAGE-----(\r)?\n(.+)((\r)?\n)/.test(text) || !/(\r)?\n-----END PGP MESSAGE-----((\r)?\n)?/.test(text)) {
socket.emit('checkActiveEmailError', 0);
return saveLog(`checkActiveEmailSubmit, no text.length !`);
/*
if ( ! text || ! text.length || !/^-----BEGIN PGP MESSAGE-----/.test ( text )) {
socket.emit ( 'checkActiveEmailError', 0 )
return saveLog ( `checkActiveEmailSubmit, no text.length !` )
}
*/
if (!this.QTClass) {
socket.emit('checkActiveEmailError', 2);
return saveLog(`checkActiveEmailSubmit, have no this.QTClass!`);
Expand Down
10 changes: 6 additions & 4 deletions app/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,13 @@ export class localServer {
( next: any ) => this.getPbkdf2 ( this.savedPasswrod, next ),
( data: Buffer, next: any ) => {
if ( ! options.privateKey.decrypt ( data.toString( 'hex' ))) {

return next ( new Error ('saveImapData key password error!' ))
}
this.bufferPassword = data.toString( 'hex' )
options.message = openpgp.message.readArmored ( text )
openpgp.decrypt ( options ).then ( plaintext => {

console.log ( `openpgp.decrypt success!`, plaintext )
try {
const data = JSON.parse ( plaintext.data )
return next ( null, data )
Expand All @@ -508,6 +509,7 @@ export class localServer {
}

}).catch ( err => {
console.log ( `openpgp.decrypt ERROR: `, err )
next ( err )
})
}
Expand Down Expand Up @@ -679,12 +681,12 @@ export class localServer {
})

socket.on ( 'checkActiveEmailSubmit', ( text: string ) => {

if ( ! text || ! text.length || !/^-----BEGIN PGP MESSAGE-----(\r)?\n(.+)((\r)?\n)/.test ( text ) || ! /(\r)?\n-----END PGP MESSAGE-----((\r)?\n)?/.test ( text )) {
/*
if ( ! text || ! text.length || !/^-----BEGIN PGP MESSAGE-----/.test ( text )) {
socket.emit ( 'checkActiveEmailError', 0 )
return saveLog ( `checkActiveEmailSubmit, no text.length !` )
}

*/
if ( ! this.QTClass ) {
socket.emit ( 'checkActiveEmailError', 2 )
return saveLog ( `checkActiveEmailSubmit, have no this.QTClass!` )
Expand Down
Loading

0 comments on commit 8e94bcf

Please sign in to comment.