-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·59 lines (48 loc) · 1.57 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
54
55
56
57
58
59
/*
** Deus é Santo!
*/
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
var globalUserAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36';
let win = null
app.allowRendererProcessReuse = true;
app.once('ready', () => {
win = new BrowserWindow({
width: 800,
height: 350,
show: false,
webPreferences: {
sandbox: false,
nodeIntegration: true,
nodeIntegrationInWorker: true,
webSecurity: false,
devTools: true, // false if you want to remove dev tools access for the user
contextIsolation: true,
enableRemoteModule: true, // required for print function [removed since Electron 12, uses https://github.com/electron/remote]
webviewTag: true, // https://www.electronjs.org/docs/api/webview-tag,
preload: path.join(__dirname, "preload.js"), // required for print function
}
})
win.setMenuBarVisibility(false)
win.center()
win.webContents.setUserAgent(globalUserAgent);
// win.webContents.openDevTools();
win.loadURL(url.format({
pathname: path.join(__dirname, 'application/index.html'),
protocol: 'file:',
slashes: true
}), {
userAgent: globalUserAgent
})
// Show window when page is ready
win.once('ready-to-show', () => {
win.show()
})
})
ipcMain.on('open-dev-tools', (ev, param) => {
win.webContents.openDevTools();
})
ipcMain.on('restart-application', (ev, param) => {
win.reload();
})