Skip to content

Conversation

@athal7
Copy link
Contributor

@athal7 athal7 commented Jan 7, 2026

Summary

  • Intercept navigation events in the Tauri webview using on_navigation handler
  • Open external URLs (http/https) in the system's default browser instead of navigating internally
  • Allow internal navigation (tauri://, localhost, 127.0.0.1) to proceed normally
  • Prevents users from getting stuck on a "dead end" page when clicking links in AI-generated content

Fixes #6484

@athal7 athal7 requested a review from adamdotdevin as a code owner January 7, 2026 15:24
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Intercept navigation events in the Tauri webview and open external
URLs (http/https) in the system's default browser instead of
navigating internally. This prevents users from getting stuck on
a "dead end" page when clicking links in AI-generated content.

Fixes anomalyco#6484
@athal7 athal7 force-pushed the issue-6484-external-links branch from f3fc2dd to 6dcdb98 Compare January 7, 2026 15:33
@athal7
Copy link
Contributor Author

athal7 commented Jan 7, 2026

CI failures are from upstream - all branches are currently failing with the same typecheck error:

script/build.ts(3,25): error TS2307: Cannot find module '../node_modules/@opentui/solid/scripts/solid-plugin' or its corresponding type declarations.

This is unrelated to the desktop changes in this PR.

@adamdotdevin
Copy link
Contributor

@athal7 does this work if you use an external server on a remote URL? we have the concept of connecting to remote servers now, just wondering if that was tested

@athal7
Copy link
Contributor Author

athal7 commented Jan 7, 2026

@adamdotdevin Good catch! You're right - the original implementation would have blocked navigation to remote servers.

I've updated the on_navigation handler to read the server list from the Tauri store (opencode.global.dat). Now it:

  1. Always allows localhost and 127.0.0.1 (the local server)
  2. Reads the configured servers from the store's server.list array
  3. Allows navigation to any URL whose origin matches a configured server
  4. Opens in default browser only for truly external URLs

The is_allowed_server() function extracts the origin (scheme + host + port) from both the navigation URL and each configured server, ensuring that remote servers like https://my-opencode-server.example.com work correctly.

Read the server list from Tauri store to allow navigation to
configured remote servers, not just localhost. This fixes the
issue where connecting to a remote OpenCode server would be
blocked by the external link handler.
@adamdotdevin adamdotdevin merged commit 361a962 into anomalyco:dev Jan 7, 2026
2 checks passed
adamdotdevin added a commit that referenced this pull request Jan 8, 2026
aryasaatvik pushed a commit to aryasaatvik/opencode that referenced this pull request Jan 10, 2026
zerone0x pushed a commit to zerone0x/opencode that referenced this pull request Jan 12, 2026
zerone0x pushed a commit to zerone0x/opencode that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening a link within the Linux app brings you to a "dead end"

2 participants