@@ -38,22 +38,29 @@ export function activate(context: vscode.ExtensionContext) {
3838 const file = files [ 0 ] ;
3939 vscode . workspace . openTextDocument ( file . fsPath ) . then ( result => {
4040 const content = result . getText ( ) ;
41- debugger ;
4241 let url : string ;
42+ let strictSSL : boolean ;
4343 if ( content [ 0 ] === '{' ) {
4444 const configuration = JSON . parse ( content ) ;
4545 url = configuration . Generator . Connection ;
46+ strictSSL = configuration . Generator . VerifySsl ;
4647 }
4748 else {
4849 const start = content . indexOf ( '<Generator>' ) + 11 ;
4950 const end = content . indexOf ( '</Generator>' ) ;
5051 const generatorNode = content . substring ( start , end ) ;
5152 const connectionStart = generatorNode . indexOf ( '<Connection>' ) + 12 ;
52- const connectionEnd = generatorNode . indexOf ( '</Connection>' ) ;
53+ const connectionEnd = generatorNode . indexOf ( '</Connection>' ) ;
5354 url = generatorNode . substring ( connectionStart , connectionEnd ) . trim ( ) ;
55+ const verifySslStart = generatorNode . indexOf ( '<VerifySsl>' ) + 11 ;
56+ const verifySslEnd = generatorNode . indexOf ( '</VerifySsl>' ) ;
57+ strictSSL = verifySslEnd === - 1 || generatorNode . substring ( verifySslStart , verifySslEnd ) . trim ( ) !== 'false' ;
58+ }
59+ if ( strictSSL === false ) {
60+ process . env [ 'NODE_TLS_REJECT_UNAUTHORIZED' ] = 0 ;
5461 }
5562 let id : string ;
56- http . post ( url + '/Create' , { configuration : content } )
63+ http . post ( url + '/Create' , { configuration : content , } )
5764 . then ( ( response : any ) => {
5865 id = response . data ;
5966 return http . get ( url + '/GetFiles/' + id ) ;
@@ -76,10 +83,10 @@ export function activate(context: vscode.ExtensionContext) {
7683 } ) ;
7784 promises . push ( promise ) ;
7885 } ) ;
79- return Promise . all ( promises ) ;
86+ return Promise . all ( promises ) . then ( ( ) => filePaths . length ) ;
8087 } )
81- . then ( ( ) => {
82- vscode . window . showInformationMessage ( 'Done ') ;
88+ . then ( ( count : number ) => {
89+ vscode . window . showInformationMessage ( count + ' files generated ') ;
8390 } )
8491 . catch ( ( error : Error ) => {
8592 vscode . window . showErrorMessage ( 'Can not reach the generator server #231d\r\n' + error ) ;
0 commit comments