Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// It is required to use ipcRenderer in renderer process.
// But it is not secure, so if you want to disable this option, please use preload script.
nodeIntegration: true,
contextIsolation: false,
preload: path.resolve(__dirname, './preload.js')
}
}
const config: Config = {
windowOpts: mainOpts,
templateUrl: splashURL,
splashScreenOpts: {
width: 425,
height: 325
}
}
mainWindow = initSplashScreen(config)
mainWindowState.manage(mainWindow)
mainWindow.loadURL(winURL)
mainWindow.webContents.on('will-navigate', event => event.preventDefault())
/**
* Get system proxy configuration.
*/
if (session && session.defaultSession) {
session.defaultSession.resolveProxy('https://mastodon.social', proxyInfo => {
proxyConfiguration.setSystemProxy(proxyInfo)
log.info(`System proxy configuration: ${proxyInfo}`)
})
}
},
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
const windowOptions = {
width: 1250,
height: 780,
show: false,
icon: process.platform === 'linux' && path.join(__dirname, '../icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webSecurity: false,
},
};
global.mainWindow = initSplashScreen({
windowOpts: windowOptions,
templateUrl: path.join(__dirname, '../public/images/splashscreen.svg'),
delay: 0,
splashScreenOpts: {
height: 340,
width: 340,
transparent: true,
},
});
mainWindow.loadURL(isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../index.html')}`);
if (isDev) {
mainWindow.webContents.openDevTools();
// Need to require this globally so we can keep it as a
// dev-only dependency
const {
default: installExtension,
const windowOptions: Electron.BrowserWindowConstructorOptions = {
backgroundColor: darkDarkBlack,
frame: false,
height: 768,
icon: path.join(__dirname, 'resources/images/64x64.png'),
minHeight: 500,
minWidth: 1024,
show: false,
webPreferences: {
webSecurity: false,
nodeIntegration: true
},
width: 1024
};
// configure the splashscreen
mainWindow = Splashscreen.initSplashScreen({
splashScreenOpts: {
height: 400,
transparent: true,
width: 400
},
templateUrl: path.join(__dirname, 'resources', 'images', 'icon.png'),
windowOpts: windowOptions
});
// Open the DevTools.
if (isDev) {
await installExtension(REDUX_DEVTOOLS);
await installExtension(REACT_DEVELOPER_TOOLS);
mainWindow.webContents.openDevTools();
}
id: 'main-window',
title: electron.app.getName(),
width: 1170,
height: 800,
minWidth: 1170,
minHeight: 800,
webPreferences: {
nodeIntegration: true,
webSecurity: true,
disableBlinkFeatures: 'Auxclick',
preload: path.resolve(__dirname, 'preload.js')
},
icon: __static + '/assets/icons/png/newlogo-256x256.png'
};
let mainWindow = initSplashScreen({
windowOpts: windowOptions,
templateUrl: path.join(__static, '/splash-screen.html'),
delay: 0,
minVisible: 1500,
splashScreenOpts: {
height: 800,
width: 1170,
transparent: true
}
});
mainWindow.shouldIgnoreClose = true;
mainWindow.shouldIgnoreCloseDialog = false; // in order to don't show prompt window
Menu.setApplicationMenu(Menu.buildFromTemplate(createMenuTemplate(mainWindow)));
const config: Splashscreen.Config = {
windowOpts: {
x: 0,
y: 0,
width: 1080,
height: 650
},
templateUrl: path.join(__dirname, 'dist/assets/splash-screen.html'),
splashScreenOpts: {
width: 400,
height: 460
},
minVisible: 2000
};
win = Splashscreen.initSplashScreen(config);
win.setMenuBarVisibility(false);
if (serve) {
require('electron-reload')(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)
});
win.loadURL('http://localhost:4200');
} else {
win.loadURL(url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}));
}