@@ -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 ) => / ^ n o s t r : / 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' && / ^ \/ l o g i n \/ ( g o o g l e | e m a i l ) \/ ? $ / i. test ( url . pathname ) ;
114+ } catch {
115+ return false ;
116+ }
117+ }
118+
91119function nostrIdentifierFromUrl ( url = '' ) {
92120 const clean = String ( url ) . trim ( ) ;
93121 if ( ! / ^ n o s t r : / i. test ( clean ) ) return '' ;
0 commit comments