'use strict' ; declare const __static ; import { app , BrowserWindow , protocol , shell } from 'electron' ; import { autoUpdater } from 'electron-updater' ; import path from 'path' ; import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' ; const isDevelopment = process . env . NODE_ENV === 'development' ; let win ; protocol . registerSchemesAsPrivileged ( [ { scheme : 'app' , privileges : { secure : true , standard : true , supportFetchAPI : true } } ] ) ; function createWindow ( ) { win = new BrowserWindow ( { width : 1280 , height : 720 , frame : false , icon : path . join ( __static , 'icon.png' ) , webPreferences : { nodeIntegration : true , enableRemoteModule : true , contextIsolation : false } } ) ; if ( process . env . WEBPACK_DEV_SERVER_URL ) { win . loadURL ( process . env . WEBPACK_DEV_SERVER_URL as string ) ; if ( ! process . env . IS_TEST ) win . webContents . openDevTools ( ) ; } else { createProtocol ( 'app' ) ; win . loadURL ( 'app://./index.html' ) ; } win . on ( 'closed' , ( ) => { win = null ; } ) ; function isSafeishURL ( url ) { return url . startsWith ( 'http:' ) || url . startsWith ( 'https:' ) ; } win . webContents . on ( 'will-navigate' , ( event , url ) => { event . preventDefault ( ) ; if ( isSafeishURL ( url ) ) { shell . openExternal ( url ) ; } } ) ; } app . on ( 'window-all-closed' , ( ) => { if ( process . platform !== 'darwin' ) { app . quit ( ) ; } } ) ; app . on ( 'activate' , ( ) => { if ( win === null ) { createWindow ( ) ; } } ) ; app . on ( 'ready' , async ( ) => { if ( isDevelopment && ! process . env . IS_TEST ) { } else { autoUpdater . logger = console ; autoUpdater . checkForUpdatesAndNotify ( ) ; } createWindow ( ) ; } ) ; if ( isDevelopment ) { if ( process . platform === 'win32' ) { process . on ( 'message' , data => { if ( data === 'graceful-exit' ) { app . quit ( ) ; } } ) ; } else { process . on ( 'SIGTERM' , ( ) => { app . quit ( ) ; } ) ; } }