Skip to content

v0.1.8 — route external target=_blank to OS browser#1

Merged
AminChirazi merged 1 commit into
mainfrom
feat/external-links-to-os-browser
May 4, 2026
Merged

v0.1.8 — route external target=_blank to OS browser#1
AminChirazi merged 1 commit into
mainfrom
feat/external-links-to-os-browser

Conversation

@AminChirazi

Copy link
Copy Markdown
Contributor

Summary

  • Click handler + window.open override now split routing by destination host:
    • `internal.automators.com` / `auth.automators.com` → in-window navigation (kept from v0.1.6)
    • Anything else → routed to OS default browser via `plugin:shell|open` IPC
  • Bumps to v0.1.8 across package.json, Cargo.toml, tauri.conf.json

Why

v0.1.6 hijacked the entire shell window off to capacities.app when the user clicked "Capacities" in the sidebar. The user lost their place inside internal and the only way back was ⌘←. Wrong UX for "this is a different app" links — those should pop a real browser tab.

`shell:allow-open` is already in the default capability, so no security change needed.

Test plan

  • Tag `v0.1.8` after merge → release workflow builds + drafts release
  • Publish the release manually so installed shells auto-update
  • Click "Capacities" in the sidebar → opens in the user's default browser, internal stays put
  • Click an internal cross-link with `target="_blank"` → still navigates in-window
  • ⌘-click any link → still goes through default WebView handling (OS browser on macOS)

🤖 Generated with Claude Code

v0.1.6 forced every target=_blank click to navigate in-window
so the shell would feel like an app. That worked for cross-
internal links but trapped users on external destinations:
clicking Capacities in the sidebar hijacked the entire shell
window off to capacities.app, with no way back except ⌘←.

Split the rule by destination host. INTERNAL_HOSTS (mirrors
the capability's remote.urls allowlist: internal.automators.com,
auth.automators.com) navigates in-window. Everything else
routes through plugin:shell|open IPC → OS default browser.

The shell:open permission is already in the default capability,
so no security-side change. Adds a defensive try/catch + a
safety-net fallback so a missing IPC bridge degrades to in-
window navigation rather than a dead click.

Bumps versions in lockstep across package.json, Cargo.toml, and
tauri.conf.json. Tag v0.1.8 to trigger the release workflow.
Copilot AI review requested due to automatic review settings May 4, 2026 12:00
@AminChirazi AminChirazi merged commit 6ec79a8 into main May 4, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Tauri shell’s handling of target="_blank" / window.open() so that internal links keep navigating inside the app window, while external links open in the OS default browser, and bumps the app version to v0.1.8.

Changes:

  • Route target="_blank" clicks and window.open() calls by destination host (internal hosts stay in-window; external hosts use plugin:shell|open).
  • Add helper logic (INTERNAL_HOSTS, isInternalHost, openExternal) to support the split behavior and preserve modifier-click behavior.
  • Bump version numbers to 0.1.8 across Tauri config, Rust crate, and npm package.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src-tauri/tauri.conf.json Bumps shell app version to 0.1.8.
src-tauri/src/lib.rs Updates injected JS to route target="_blank" / window.open() differently for internal vs external hosts.
src-tauri/Cargo.toml Bumps Rust crate version to 0.1.8.
package.json Bumps npm package version to 0.1.8.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-tauri/src/lib.rs
Comment on lines +164 to +173
function openExternal(href) {
if (window.__TAURI_INTERNALS__ && window.__TAURI_INTERNALS__.invoke) {
try {
window.__TAURI_INTERNALS__.invoke('plugin:shell|open', { path: href });
return true;
} catch (e) {
return false;
}
}
return false;
Comment thread src-tauri/src/lib.rs
Comment on lines 190 to 201
var origOpen = window.open;
window.open = function(url) {
if (typeof url === 'string' && url) {
window.location.href = url;
if (isInternalHost(url)) {
window.location.href = url;
return null;
}
if (openExternal(url)) {
return null;
}
window.location.href = url; // safety-net fallback
return null;
Comment thread src-tauri/Cargo.toml
Comment on lines 1 to +3
[package]
name = "internal-desktop"
version = "0.1.7"
version = "0.1.8"
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.

2 participants