From 093cea0f3fe9b7d34b28a9ea6bc34fa93469f6e9 Mon Sep 17 00:00:00 2001 From: Srinaath Ravichandran Date: Wed, 18 Mar 2020 10:22:12 -0700 Subject: [PATCH 1/2] Recator isUsingNgrok Signed-off-by: Srinaath Ravichandran --- packages/app/main/src/ngrokService.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/app/main/src/ngrokService.ts b/packages/app/main/src/ngrokService.ts index 75cb100e5..641c5ab52 100644 --- a/packages/app/main/src/ngrokService.ts +++ b/packages/app/main/src/ngrokService.ts @@ -74,13 +74,7 @@ export class NgrokService { if (this.pendingRecycle) { await this.pendingRecycle; } - - const { bypassNgrokLocalhost, runNgrokAtStartup } = getSettings().framework; - // Use ngrok - const local = !botUrl || isLocalHostUrl(botUrl); - - const useNgrok = runNgrokAtStartup || !local || (local && !bypassNgrokLocalhost); - if (useNgrok) { + if (this.isUsingNgrok(botUrl)) { if (!this.ngrok.running()) { await this.startup(); } @@ -237,7 +231,7 @@ export class NgrokService { ); } else if (!this.ngrokPath) { this.reportNotConfigured(conversationId); - } else if (this.ngrok.running()) { + } else if (this.isUsingNgrok(botUrl)) { this.reportRunning(conversationId); } else { emulatorApplication.mainWindow.logService.logToChat( @@ -312,4 +306,12 @@ export class NgrokService { } this.localhost = hostname; } + + private isUsingNgrok(botUrl: string) { + const { bypassNgrokLocalhost, runNgrokAtStartup } = getSettings().framework; + // Use ngrok + const local = !botUrl || isLocalHostUrl(botUrl); + + return runNgrokAtStartup || !local || (local && !bypassNgrokLocalhost); + } } From 1c8e0d2fca3960836156c810e3f52c63fd69e679 Mon Sep 17 00:00:00 2001 From: Srinaath Ravichandran Date: Wed, 18 Mar 2020 10:31:00 -0700 Subject: [PATCH 2/2] Remove spaces Signed-off-by: Srinaath Ravichandran Changelog updated Signed-off-by: Srinaath Ravichandran --- CHANGELOG.md | 2 +- packages/app/main/src/ngrokService.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49b4b55e7..cfb80165c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [client] Disable "Restart conversation from here" bubble on DL Speech bots [2107](https://github.com/microsoft/BotFramework-Emulator/pull/2107) - [client] Fixed an issue where starting a conversation with an unset custom user ID was causing the User member of the conversation to have a blank `id` field in PR [2108](https://github.com/microsoft/BotFramework-Emulator/pull/2108) - [main] Fixed an issue where the setting `Bypass Ngrok for local addresses` was continuing to use the ngrok tunnel even for local bots in PR [2111](https://github.com/microsoft/BotFramework-Emulator/pull/2111) - +- [main] Ngrok Reporting made accurate in PR [2113](https://github.com/microsoft/BotFramework-Emulator/pull/2113) ## v4.8.0 - 2019 - 03 - 12 ## Added diff --git a/packages/app/main/src/ngrokService.ts b/packages/app/main/src/ngrokService.ts index 641c5ab52..90af3fb5d 100644 --- a/packages/app/main/src/ngrokService.ts +++ b/packages/app/main/src/ngrokService.ts @@ -309,9 +309,7 @@ export class NgrokService { private isUsingNgrok(botUrl: string) { const { bypassNgrokLocalhost, runNgrokAtStartup } = getSettings().framework; - // Use ngrok const local = !botUrl || isLocalHostUrl(botUrl); - return runNgrokAtStartup || !local || (local && !bypassNgrokLocalhost); } }