diff --git a/package.json b/package.json index 3b3e994..a7cfa52 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ky-generator", "displayName": "KY-Generator", "description": "Visual Studio Code Extension for KY.Generator", - "version": "1.0.2", + "version": "1.0.3", "publisher": "KY-Programming", "icon": "images/128.png", "repository": "https://github.com/KY-Programming/generator-vs-code", @@ -29,7 +29,8 @@ "compile": "tsc -p ./", "watch": "tsc -watch -p ./", "postinstall": "node ./node_modules/vscode/bin/install", - "test": "npm run compile && node ./node_modules/vscode/bin/test" + "test": "npm run compile && node ./node_modules/vscode/bin/test", + "publish": "vsce publish" }, "devDependencies": { "typescript": "^2.6.1", diff --git a/src/extension.ts b/src/extension.ts index f877b07..f2c0517 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,22 +38,29 @@ export function activate(context: vscode.ExtensionContext) { const file = files[0]; vscode.workspace.openTextDocument(file.fsPath).then(result => { const content = result.getText(); - debugger; let url: string; + let strictSSL: boolean; if (content[0] === '{') { const configuration = JSON.parse(content); url = configuration.Generator.Connection; + strictSSL = configuration.Generator.VerifySsl; } else { const start = content.indexOf('') + 11; const end = content.indexOf(''); const generatorNode = content.substring(start, end); const connectionStart = generatorNode.indexOf('') + 12; - const connectionEnd = generatorNode.indexOf(''); + const connectionEnd = generatorNode.indexOf(''); url = generatorNode.substring(connectionStart, connectionEnd).trim(); + const verifySslStart = generatorNode.indexOf('') + 11; + const verifySslEnd = generatorNode.indexOf(''); + strictSSL = verifySslEnd === -1 || generatorNode.substring(verifySslStart, verifySslEnd).trim() !== 'false'; + } + if (strictSSL === false) { + process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0; } let id: string; - http.post(url + '/Create', { configuration: content }) + http.post(url + '/Create', { configuration: content, }) .then((response: any) => { id = response.data; return http.get(url + '/GetFiles/' + id); @@ -76,10 +83,10 @@ export function activate(context: vscode.ExtensionContext) { }); promises.push(promise); }); - return Promise.all(promises); + return Promise.all(promises).then(() => filePaths.length); }) - .then(() => { - vscode.window.showInformationMessage('Done'); + .then((count: number) => { + vscode.window.showInformationMessage(count + ' files generated'); }) .catch((error: Error) => { vscode.window.showErrorMessage('Can not reach the generator server #231d\r\n' + error);