-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
53 lines (46 loc) · 1.52 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const {app, BrowserWindow} = require('electron')
const path = require('path')
const config = require('./config.json')
let mainWindow
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit()
})
let ppapi_flash_path
if(process.platform == 'win32'){
ppapi_flash_path = path.join(__dirname, 'pepflashplayer.dll')
} else if (process.platform == 'linux') {
ppapi_flash_path = path.join(__dirname, 'libpepflashplayer.so')
} else if (process.platform == 'darwin') {
ppapi_flash_path = path.join(__dirname, 'PepperFlashPlayer.plugin')
}
app.commandLine.appendSwitch('ignore-certificate-errors', true)
app.commandLine.appendSwitch('ppapi-flash-path', ppapi_flash_path)
app.on('ready', function() {
mainWindow = new BrowserWindow({
'webPreferences': {
'plugins': true,
'nodeIntegration': false
},
})
mainWindow.maximize()
if(config.url === '') {
// Goes to local page
mainWindow.loadURL('file://' + __dirname + '/assets/index.html');
} else {
// Preload Url from Config File
mainWindow.loadURL(config.url)
}
// Open Dev Tools
// mainWindow.webContents.openDevTools();
mainWindow.webContents.session.webRequest.onHeadersReceived({ urls: [ "*://*/*" ] },
(d, c)=>{
if(d.responseHeaders['X-Frame-Options']){
delete d.responseHeaders['X-Frame-Options'];
} else if(d.responseHeaders['x-frame-options']) {
delete d.responseHeaders['x-frame-options'];
}
c({cancel: false, responseHeaders: d.responseHeaders});
}
);
})