fix: confirm intercepted external links#2515
Conversation
Greptile SummaryThis PR adds a confirmation dialog before opening external links intercepted by the main Electron process — both
Confidence Score: 5/5Safe to merge — the change narrows a gap where external links bypassed the existing confirmation modal, and the fallback path is explicitly logged. The new IPC flow correctly threads intercepted links through the renderer's existing confirmation modal without introducing new code paths that could break existing behavior. The fallback to direct shell.openExternal when the main window is absent preserves the previous behavior for that narrow edge case and logs a warning. No logic errors or data-loss risks were identified in the changed files. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/utils/externalLinks.ts | Adds requestExternalLinkOpen() helper that routes intercepted links through an IPC event to the renderer instead of calling shell.openExternal() directly; includes a fallback to direct-open when the main window is unavailable. |
| apps/emdash-desktop/src/renderer/lib/external-link-requests.ts | New file wiring the renderer-side IPC listener; calls confirmOpenExternalLink on incoming events and returns the deregistration callback (which the caller in main.tsx currently discards). |
| apps/emdash-desktop/src/renderer/main.tsx | Calls wireExternalLinkRequests() during bootstrap alongside the other wire* helpers; minimal and consistent with the existing pattern. |
| apps/emdash-desktop/src/shared/events/appEvents.ts | Adds externalLinkOpenRequestedChannel event definition with { url: string } payload; straightforward addition following existing channel conventions. |
Sequence Diagram
sequenceDiagram
participant R as Renderer
participant M as Main Process
participant D as Dialog (Renderer)
participant B as Default Browser
R->>M: window.open() / navigation
M->>M: setWindowOpenHandler / will-navigate
alt main window available
M->>R: "IPC: externalLinkOpenRequestedChannel { url }"
R->>D: confirmOpenExternalLink(url)
D->>R: user confirms
alt open in default browser
R->>M: rpc.app.openExternal(url)
M->>B: shell.openExternal(url)
else open in emdash browser
R->>R: taskView.tabGroupManager.openBrowser(url)
end
else main window unavailable (fallback)
M->>B: shell.openExternal(url) - no confirmation
end
Reviews (2): Last reviewed commit: "fix(app): harden external link requests" | Re-trigger Greptile
Description
Checklist
messages and, when possible, the PR title