We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c2edd85 commit 43b8d5aCopy full SHA for 43b8d5a
1 file changed
src/electron.js
@@ -1,4 +1,4 @@
1
-const { app, BrowserWindow } = require('electron');
+const { app, BrowserWindow, shell } = require('electron');
2
const path = require('path');
3
4
function createWindow(dir = '') {
@@ -35,6 +35,20 @@ function createWindow(dir = '') {
35
win.setFullScreen(!win.isFullScreen());
36
}
37
});
38
+
39
+ win.webContents.on('will-navigate', (event, url) => {
40
+ const { host } = new URL(url);
41
+ if (host === 'undercards.net') return;
42
43
+ event.preventDefault();
44
+ if (host === 'www.undercards.net') {
45
+ win.loadURL(url.replace('www.', ''));
46
+ } else if (host === 'unpkg.com' && url.endsWith('undercards.user.js')) {
47
+ // Trigger update
48
+ } else {
49
+ shell.openExternal(url);
50
+ }
51
+ });
52
53
54
app.on('window-all-closed', () => {
0 commit comments