()
| 358 | // This function is used to hide the splash screen and create/launch |
| 359 | // new window to render pgAdmin4 page. |
| 360 | function launchPgAdminWindow() { |
| 361 | // Create and launch new window and open pgAdmin url |
| 362 | misc.writeServerLog('Application Server URL: ' + startPageUrl); |
| 363 | pgAdminMainScreen = new BrowserWindow({ |
| 364 | 'id': 'pgadmin-main', |
| 365 | 'icon': '../../assets/pgAdmin4.png', |
| 366 | 'frame': true, |
| 367 | 'position': 'center', |
| 368 | 'resizable': true, |
| 369 | 'minWidth': 640, |
| 370 | 'minHeight': 480, |
| 371 | 'width': 1024, |
| 372 | 'height': 768, |
| 373 | 'focus': true, |
| 374 | 'show': false, |
| 375 | webPreferences: { |
| 376 | nodeIntegrationInSubFrames: true, |
| 377 | preload: path.join(__dirname, 'pgadmin_preload.js'), |
| 378 | }, |
| 379 | }); |
| 380 | |
| 381 | splashWindow.close(); |
| 382 | pgAdminMainScreen.webContents.session.clearCache(); |
| 383 | |
| 384 | setupMenu(pgAdminMainScreen, configStore, menuCallbacks); |
| 385 | |
| 386 | setupDownloader(); |
| 387 | |
| 388 | pgAdminMainScreen.loadURL(startPageUrl); |
| 389 | |
| 390 | const bounds = configStore.get('bounds'); |
| 391 | |
| 392 | (bounds && isWithinDisplayBounds({x: bounds.x, y: bounds.y})) ? pgAdminMainScreen.setBounds(bounds) : |
| 393 | pgAdminMainScreen.setBounds({x: 0, y: 0, width: 1024, height: 768}); |
| 394 | |
| 395 | pgAdminMainScreen.show(); |
| 396 | |
| 397 | setupAutoUpdater({ |
| 398 | pgAdminMainScreen, |
| 399 | configStore, |
| 400 | menuCallbacks, |
| 401 | baseUrl, |
| 402 | UUID, |
| 403 | forceQuitAndInstallUpdate, |
| 404 | }); |
| 405 | |
| 406 | pgAdminMainScreen.webContents.setWindowOpenHandler(({url})=>{ |
| 407 | let openDocsInBrowser = configStore.get('openDocsInBrowser', true); |
| 408 | let isDocURL = false; |
| 409 | docsURLSubStrings.forEach(function (key) { |
| 410 | if (url.indexOf(key) >= 0) { |
| 411 | isDocURL = true; |
| 412 | } |
| 413 | }); |
| 414 | |
| 415 | if (openDocsInBrowser && isDocURL) { |
| 416 | // Do not open the window |
| 417 | shell.openExternal(url); |
no test coverage detected