Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ngrok reporting made accurate #2113

Merged
merged 2 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
Comment on lines +310 to +314
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

}