Skip to content

fix(desktop): restore default window-open handling for non-explorer links#3516

Merged
domw30 merged 1 commit into
mainfrom
fix/desktop-window-open-links
Jul 13, 2026
Merged

fix(desktop): restore default window-open handling for non-explorer links#3516
domw30 merged 1 commit into
mainfrom
fix/desktop-window-open-links

Conversation

@domw30

@domw30 domw30 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #3514. That PR routed the ZNS explorer to the system browser via webContents.setWindowOpenRules, but that API replaces ToDesktop's entire window-open handler rather than adding to it. Because the rule set had no fallback, every other window.open on desktop matched no rule and silently did nothing — messenger chat-bubble links, block-explorer links, the OAuth login popup, and attachment downloads all stopped working.

This reconstructs ToDesktop's domain-aware default alongside the explorer override.

Behavior after this change

Rules are evaluated in order (first match wins); fallback handles the rest:

URL Handling
Explorer family (config.znsExplorerUrl root domain) System browser
about:blank In-app (keeps the attachment download window handle)
App's own root domain (ZERO_API_URL / current origin) In-app (preserves the OAuth postMessage handshake)
Everything else (external) System browser (chat links, block explorers, arweave, …)

This matches ToDesktop's documented default (with "Open same-domain URLs externally" off, same-domain opens in-app and external opens in the browser), with the explorer carved out to the browser.

Testing

Verified in a local ToDesktop build (Zero Local):

  • ✅ Messenger chat-bubble links open in the system browser
  • ✅ Explorer claim button opens in the system browser
  • ✅ OAuth login works
  • ✅ Attachment downloads work

…inks

setWindowOpenRules replaces ToDesktop's entire window-open handler rather
than adding to it. The previous change registered only an explorer rule with
no fallback, so every other window.open (chat-bubble links, block-explorer
links, the OAuth popup, attachment downloads) matched no rule and silently
did nothing.

Reconstruct ToDesktop's domain-aware default alongside the explorer override:
explorer family -> system browser; about:blank and the app's own root domain
(ZERO_API_URL / current origin) -> in-app, preserving the OAuth postMessage
handshake and attachment downloads; everything else -> system browser via
fallback, restoring external links.
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
z-os Ready Ready Preview Jul 13, 2026 9:19pm

Request Review

@domw30
domw30 merged commit d073584 into main Jul 13, 2026
7 checks passed
@domw30
domw30 deleted the fix/desktop-window-open-links branch July 13, 2026 21:20
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.

1 participant