Skip to content
Merged
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
17 changes: 14 additions & 3 deletions internal/menubar/popover_darwin.m
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,20 @@ - (void)userContentController:(WKUserContentController *)userContentController
}

if ([action isEqualToString:@"open_dashboard"]) {
NSURL *url = [NSURL URLWithString:@"http://localhost:9211"];
if (url) {
[[NSWorkspace sharedWorkspace] openURL:url];
// Derive the dashboard origin from the webview's own URL so we honor the
// runtime port (ONWATCH_PORT / --port) without threading it through CGO.
NSURL *current = self.webView.URL;
if (!current || ![self isLocalURL:current]) {
return;
}
NSURLComponents *components =
[NSURLComponents componentsWithURL:current resolvingAgainstBaseURL:NO];
components.path = @"";
components.query = nil;
components.fragment = nil;
NSURL *dashboardURL = components.URL;
if (dashboardURL) {
[[NSWorkspace sharedWorkspace] openURL:dashboardURL];
[self close];
}
}
Expand Down
Loading