File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,34 @@ function createWindow () {
2020 evt . preventDefault ( ) ;
2121 } ) ;
2222
23- win . webContents . on ( 'new-window' , function ( e , url ) {
24- if ( url . startsWith ( 'https://identity.bitclout.com/' ) ) {
25- return ;
26- }
23+ win . webContents . on ( 'will-navigate' , function ( event , url ) {
24+ handleNavigate ( win , event , url ) ;
25+ } ) ;
2726
28- e . preventDefault ( ) ;
29- shell . openExternal ( url ) ;
27+ win . webContents . on ( 'new-window' , function ( event , url ) {
28+ handleNavigate ( win , event , url ) ;
3029 } ) ;
3130}
3231
32+ function handleNavigate ( win , event , url ) {
33+ win . setTitle ( url ) ;
34+
35+ // Allow bitclout-approved URLs
36+ if ( url . startsWith ( 'https://bitclout.com/' ) || url . startsWith ( 'https://identity.bitclout.com/' ) ) {
37+ return ;
38+ }
39+
40+ event . preventDefault ( ) ;
41+
42+ // Only allow URLs and emails
43+ if ( ! url . startsWith ( 'https://' ) && ! url . startsWith ( 'http://' ) && ! url . startsWith ( 'mailto:' ) ) {
44+ return ;
45+ }
46+
47+ // Open https links in external browser
48+ shell . openExternal ( url ) ;
49+ }
50+
3351app . whenReady ( ) . then ( ( ) => {
3452 createWindow ( )
3553
Original file line number Diff line number Diff line change 11{
22 "name" : " BitClout" ,
3- "version" : " 1.0.2 " ,
3+ "version" : " 1.0.3 " ,
44 "description" : " bitclout.com electron app" ,
55 "main" : " main.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments