fix(desktop): restore default window-open handling for non-explorer links#3516
Merged
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 nofallback, every otherwindow.openon 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);
fallbackhandles the rest:config.znsExplorerUrlroot domain)about:blankZERO_API_URL/ current origin)postMessagehandshake)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):