"use strict" ; import { app , protocol , BrowserWindow , ipcMain } from "electron" ; import { createProtocol } from "vue-cli-plugin-electron-builder/lib" ; import installExtension , { VUEJS_DEVTOOLS } from "electron-devtools-installer" ; import { setupMenu } from "./menu" ; import * as Sentry from "@sentry/electron" ; if ( process . env . VUE_APP_SENTRY_DNS ) { Sentry . init ( { dsn : process . env . VUE_APP_SENTRY_DNS } ) ; } require ( "@electron/remote/main" ) . initialize ( ) ; const isDevelopment = process . env . NODE_ENV !== "production" ; app . commandLine . appendSwitch ( "--disable-seccomp-filter-sandbox" ) ; let win ; protocol . registerSchemesAsPrivileged ( [ { scheme : "app" , privileges : { secure : true , standard : true } } ] ) ; function createWindow ( ) { win = new BrowserWindow ( { width : 1280 , height : 720 , frame : false , webPreferences : { nodeIntegration : true , webSecurity : false , contextIsolation : false , enableRemoteModule : true } } ) ; win . maximize ( ) ; setupMenu ( ) ; if ( process . env . WEBPACK_DEV_SERVER_URL ) { win . loadURL ( process . env . WEBPACK_DEV_SERVER_URL as string ) ; } else { createProtocol ( "app" ) ; win . loadURL ( "app://./index.html" ) ; } win . on ( "closed" , ( ) => { win = null ; } ) ; } 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 ) { try { await installExtension ( { id : "ljjemllljcmogpfapbkkighbhhppjdbg" , electron : ">=1.2.1" } ) ; } catch ( e ) { console . error ( "Vue Devtools failed to install:" , e . toString ( ) ) ; } } protocol . registerFileProtocol ( "image" , ( request , callback ) => { const url = request . url . replace ( "image://" , "" ) ; try { return callback ( url ) ; } catch ( error ) { console . error ( error ) ; return callback ( "" ) ; } } ) ; createWindow ( ) ; } ) ; if ( isDevelopment ) { if ( process . platform === "win32" ) { process . on ( "message" , data => { if ( data === "graceful-exit" ) { app . quit ( ) ; } } ) ; } else { process . on ( "SIGTERM" , ( ) => { app . quit ( ) ; } ) ; } }