66d6ba8689
* feat: deprecate default value of nodeIntegration * Use DeprecationStatus::Stable as the default instead of shadowing * change wording of deprecations * chore: also deprecate kWebviewTag and kContextIsolation * chore: do as we preach, lets be secure-by-default in the default app
38 lines
869 B
JavaScript
38 lines
869 B
JavaScript
const {app, BrowserWindow} = require('electron')
|
|
const path = require('path')
|
|
|
|
let mainWindow = null
|
|
|
|
// Quit when all windows are closed.
|
|
app.on('window-all-closed', () => {
|
|
app.quit()
|
|
})
|
|
|
|
exports.load = (appUrl) => {
|
|
app.on('ready', () => {
|
|
const options = {
|
|
width: 900,
|
|
height: 600,
|
|
autoHideMenuBar: true,
|
|
backgroundColor: '#FFFFFF',
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
webviewTag: false,
|
|
contextIsolation: true,
|
|
preload: path.resolve(__dirname, 'renderer.js')
|
|
},
|
|
useContentSize: true,
|
|
show: false
|
|
}
|
|
if (process.platform === 'linux') {
|
|
options.icon = path.join(__dirname, 'icon.png')
|
|
}
|
|
|
|
mainWindow = new BrowserWindow(options)
|
|
|
|
mainWindow.on('ready-to-show', () => mainWindow.show())
|
|
|
|
mainWindow.loadURL(appUrl)
|
|
mainWindow.focus()
|
|
})
|
|
}
|