@@ -68,6 +68,7 @@ function createWindow() {
6868 contextIsolation : true ,
6969 // More info: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/electron-preload-script
7070 preload : path . resolve ( __dirname , process . env . QUASAR_ELECTRON_PRELOAD ) ,
71+ devTools : ! ! process . env . DEBUGGING ,
7172 } ,
7273 show : false ,
7374 } ) ;
@@ -79,13 +80,20 @@ function createWindow() {
7980
8081 if ( ! process . env . DEBUGGING ) {
8182 mainWindow . setMenuBarVisibility ( false ) ;
82-
83- // we're on production; no access to devtools pls
84- mainWindow . webContents . on ( 'devtools-opened' , ( ) => {
85- mainWindow ?. webContents . closeDevTools ( ) ;
86- } ) ;
8783 }
8884
85+ mainWindow . webContents . setWindowOpenHandler ( ( details ) => {
86+ return {
87+ action : 'allow' ,
88+ overrideBrowserWindowOptions : {
89+ autoHideMenuBar : true ,
90+ webPreferences : {
91+ devTools : false ,
92+ } ,
93+ } ,
94+ } ;
95+ } ) ;
96+
8997 mainWindow . on ( 'closed' , ( ) => {
9098 mainWindow = undefined ;
9199 } ) ;
@@ -105,7 +113,7 @@ function createWindow() {
105113 obj [ key ] = value ;
106114 }
107115
108- function getValue ( obj : any , key : string ) {
116+ function getValue ( obj : any , key : string ) : string | undefined {
109117 const lowerCaseKey = key . toLowerCase ( ) ;
110118
111119 for ( const key of Object . keys ( obj ) ) {
@@ -160,21 +168,23 @@ function createWindow() {
160168 const cookieName = Object . keys ( parsedCookie ) [ 0 ] ;
161169
162170 const expires = getValue ( parsedCookie , 'Expires' ) ;
163- const sameSite = getValue ( parsedCookie , 'SameSite' ) ;
171+ const sameSite = getValue ( parsedCookie , 'SameSite' ) ?. toLowerCase ( ) ;
164172
165- const cookieDetails = {
173+ const cookieDetails : Electron . CookiesSetDetails = {
166174 url : 'https://deepnotes.app' ,
167175 name : cookieName ,
168176 value : parsedCookie [ cookieName ] ,
169- // domain: getValue(parsedCookie, 'Domain'),
170- // path: getValue(parsedCookie, 'Path'),
171- // secure: getValue(parsedCookie, 'Secure'),
172- // httpOnly: getValue(parsedCookie, 'HttpOnly'),
177+ domain : getValue ( parsedCookie , 'Domain' ) ,
178+ path : getValue ( parsedCookie , 'Path' ) ,
179+ secure : getValue ( parsedCookie , 'Secure' ) != null ,
180+ httpOnly : getValue ( parsedCookie , 'HttpOnly' ) != null ,
173181 expirationDate : expires ? new Date ( expires ) . getTime ( ) : undefined ,
174- // sameSite:
175- // sameSite?.toLowerCase() !== 'none'
176- // ? sameSite?.toLowerCase()
177- // : 'no_restriction',
182+ sameSite :
183+ sameSite == null
184+ ? 'lax'
185+ : sameSite === 'none'
186+ ? 'no_restriction'
187+ : ( sameSite as any ) ,
178188 } ;
179189
180190 void mainWindow ?. webContents . session . cookies
0 commit comments