Skip to content

Commit

Permalink
Ngrok reporting made accurate (#2113)
Browse files Browse the repository at this point in the history
* Recator isUsingNgrok
  • Loading branch information
srinaath authored Mar 18, 2020
1 parent 5575481 commit 957d4ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions packages/app/main/src/ngrokService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -312,4 +306,10 @@ export class NgrokService {
}
this.localhost = hostname;
}

private isUsingNgrok(botUrl: string) {
const { bypassNgrokLocalhost, runNgrokAtStartup } = getSettings().framework;
const local = !botUrl || isLocalHostUrl(botUrl);
return runNgrokAtStartup || !local || (local && !bypassNgrokLocalhost);
}
}

0 comments on commit 957d4ab

Please sign in to comment.