-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
41 lines (33 loc) · 996 Bytes
/
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
const electron = require("electron");
let mainWindow;
function createWindow () {
mainWindow = new electron.BrowserWindow({
"width": 800,
"height": 600,
"webPreferences": {
"nodeIntegration": false
}
});
electron.session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders["User-Agent"] = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
callback({
"cancel": false,
"requestHeaders": details.requestHeaders
});
});
mainWindow.loadFile("render.html");
mainWindow.on("closed", function () {
mainWindow = null;
});
}
electron.app.on("ready", createWindow);
electron.app.on("window-all-closed", function () {
if (process.platform !== "darwin") {
electron.app.quit();
}
});
electron.app.on("activate", function () {
if (mainWindow === null) {
createWindow();
}
});