Inkeep OSS Sync#624
Merged
Merged
Conversation
…d of OS browser (#617) (#2624) * [wip] claim work on fix-issue-617-external-links * test(link-authoring): RED tests for #617 — external links must reach the OS browser from every window * fix(desktop): attach external-link safety net at the window factory (#617) Move attachAssetSafetyNet from the two index.ts call sites (openProject, openEphemeralFile) into WindowManager.attachSafetyNet, so every editor window created by any factory path (spawn + ephemeral + attach, including the restart -> recreate window) inherits the deny+OS-delegate net. Closes the creation-path coverage gap where a net-less window could render an external link in a child OpenKnowledge window. Adds two optional deps (openExternal, openAsset) to WindowManagerDeps, wired from index.ts; a truthy-both guard keeps existing unit harnesses that inject neither dep unaffected. * fix(app): route WYSIWYG external link clicks through the desktop bridge (#617) internal-link.ts handlePrimary case 'external' now calls openExternalUrl (bridge-first, window.open web fallback) instead of openHashHrefInNewTab, so a desktop click reaches the OS default browser instead of Electron's default new-window (an in-app child BrowserWindow). Symmetric with the graph view. The isSafeNavigationUrl gate stays because openExternalUrl does not filter schemes. * fix(app): route sibling external-link surfaces through the bridge (#617) Migrate the remaining renderer external-open surfaces off openHashHrefInNewTab onto openExternalUrl (bridge-first, window.open web fallback), so every editor external-link click reaches the OS browser rather than depending on the main-process net: - wiki-link.ts WYSIWYG [[wikilink]] external branch (gate already present) - wiki-link-source.ts source-mode [[wikilink]] external branch (gate ADDED — openExternalUrl does not filter schemes, unlike openHashHrefInNewTab) - internal-link-helpers.ts navigateToMarkdownTarget external branch, split out from the asset fallthrough with an isSafeNavigationUrl gate ADDED Unit pins: wiki-link.external-open.test.ts mounts the real WikiLink NodeView and drives handlePrimary; internal-link-helpers.test.ts pins navigateToMarkdownTarget's external routing (bridge / web / unsafe). The CM6 source-mode click handlers gate on posAtCoords (null in jsdom) so their event-plumbing stays Playwright-covered, per convention. * fix(open-knowledge): address local review — changeset, catch bridge rejections, test cleanup + coverage (#617) * refactor(app): internalize the external-link scheme gate in openExternalUrl (#617 review) Address cloud review: make the isSafeNavigationUrl security gate structural rather than repeated at 7 call sites. openExternalUrl now refuses unsafe schemes internally (defense-in-depth), so no caller can route a javascript:/data: scheme to window.open by forgetting the check. Dropped the 5 redundant imperative caller-gates; kept the 2 that use the boolean for control flow (link chips falling through to their edit panel). Also added the missing .catch to dispatchExternalLinkClick (While-You're-Here). * docs(app): refresh stale scheme-gate comments after gate internalization (#617 review) * docs(app): refresh remaining graph-view scheme-gate comments (#617 review) GitOrigin-RevId: 07baa786f1bc6333053f9e4c4bd6ee6e5af19147
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.
Copybara-translated commits for Inkeep OSS Sync. Rebase-merge this PR so the prepared commits land directly on public main.