From 43a8781492b866166677abefe3da45a54799cd5e Mon Sep 17 00:00:00 2001 From: Cookie <52550063+Covkie@users.noreply.github.com> Date: Fri, 16 May 2025 13:34:48 -0400 Subject: [PATCH] Link Discord connections through the browser instead of a popup (#1159) Co-authored-by: Vending Machine --- src/main/utils/makeLinksOpenExternally.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/utils/makeLinksOpenExternally.ts b/src/main/utils/makeLinksOpenExternally.ts index 5d6cc75..4e9d549 100644 --- a/src/main/utils/makeLinksOpenExternally.ts +++ b/src/main/utils/makeLinksOpenExternally.ts @@ -50,7 +50,7 @@ export function handleExternalUrl(url: string, protocol?: string): { action: "de export function makeLinksOpenExternally(win: BrowserWindow) { win.webContents.setWindowOpenHandler(({ url, frameName, features }) => { try { - var { protocol, hostname, pathname } = new URL(url); + var { protocol, hostname, pathname, searchParams } = new URL(url); } catch { return { action: "deny" }; } @@ -59,8 +59,10 @@ export function makeLinksOpenExternally(win: BrowserWindow) { return createOrFocusPopup(frameName, features); } - if (url === "about:blank" || (frameName === "authorize" && DISCORD_HOSTNAMES.includes(hostname))) - return { action: "allow" }; + if (url === "about:blank") return { action: "allow" }; + + // Drop the static temp page Discord web loads for the connections popout + if (frameName === "authorize" && searchParams.get("loading") === "true") return { action: "deny" }; return handleExternalUrl(url, protocol); });