Skip to content

Commit d0911fb

Browse files
committed
fix pomegranate for exe, dmg, appimage
1 parent 8d2941e commit d0911fb

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

electron/main.cjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,30 @@ async function createWindow() {
5757
contextIsolation: true,
5858
nodeIntegration: false,
5959
preload: path.join(__dirname, 'preload.cjs'),
60+
nativeWindowOpen: true,
6061
sandbox: true
6162
}
6263
});
6364

6465
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
66+
if (isPomegranateLoginUrl(url)) {
67+
return {
68+
action: 'allow',
69+
overrideBrowserWindowOptions: {
70+
width: 560,
71+
height: 720,
72+
parent: mainWindow,
73+
title: 'Pomegranate login',
74+
backgroundColor: '#0f172a',
75+
webPreferences: {
76+
contextIsolation: true,
77+
nodeIntegration: false,
78+
nativeWindowOpen: true,
79+
sandbox: true
80+
}
81+
}
82+
};
83+
}
6584
void shell.openExternal(url);
6685
return { action: 'deny' };
6786
});
@@ -88,6 +107,15 @@ function findNostrUrl(argv = process.argv) {
88107
return argv.find((argument) => /^nostr:/i.test(argument)) || '';
89108
}
90109

110+
function isPomegranateLoginUrl(value) {
111+
try {
112+
const url = new URL(value);
113+
return url.protocol === 'https:' && url.hostname === 'auth.njump.me' && /^\/login\/(google|email)\/?$/i.test(url.pathname);
114+
} catch {
115+
return false;
116+
}
117+
}
118+
91119
function nostrIdentifierFromUrl(url = '') {
92120
const clean = String(url).trim();
93121
if (!/^nostr:/i.test(clean)) return '';

0 commit comments

Comments
 (0)