Skip to content

Commit 43a8781

Browse files
CovkieVendicated
andauthored
Link Discord connections through the browser instead of a popup (#1159)
Co-authored-by: Vending Machine <vendicated@riseup.net>
1 parent b17fef9 commit 43a8781

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/utils/makeLinksOpenExternally.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function handleExternalUrl(url: string, protocol?: string): { action: "de
5050
export function makeLinksOpenExternally(win: BrowserWindow) {
5151
win.webContents.setWindowOpenHandler(({ url, frameName, features }) => {
5252
try {
53-
var { protocol, hostname, pathname } = new URL(url);
53+
var { protocol, hostname, pathname, searchParams } = new URL(url);
5454
} catch {
5555
return { action: "deny" };
5656
}
@@ -59,8 +59,10 @@ export function makeLinksOpenExternally(win: BrowserWindow) {
5959
return createOrFocusPopup(frameName, features);
6060
}
6161

62-
if (url === "about:blank" || (frameName === "authorize" && DISCORD_HOSTNAMES.includes(hostname)))
63-
return { action: "allow" };
62+
if (url === "about:blank") return { action: "allow" };
63+
64+
// Drop the static temp page Discord web loads for the connections popout
65+
if (frameName === "authorize" && searchParams.get("loading") === "true") return { action: "deny" };
6466

6567
return handleExternalUrl(url, protocol);
6668
});

0 commit comments

Comments
 (0)