Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 80a9c9e

Browse files
committed
fix: never open external links with electron.
1 parent 72757c8 commit 80a9c9e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

electron/start-electron.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ const debug = require('debug')('ngx:ssb:init');
7979
setTimeout(() => process.exit(0), 500);
8080
});
8181

82+
const handleRedirect = (event: any, redirectUrl: string) => {
83+
event.preventDefault();
84+
require('electron').shell.openExternal(redirectUrl);
85+
return false;
86+
};
87+
88+
win.webContents.on('will-navigate', handleRedirect);
89+
win.webContents.on('new-window', handleRedirect);
90+
8291
protocol.registerBufferProtocol('ssb', createBlobHandler());
8392
}
8493

0 commit comments

Comments
 (0)