forked from iamkarlson/notion-snap
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.js
34 lines (28 loc) · 920 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
const { app, BrowserWindow, shell, session } = require("electron");
const { registerMenuHandling } = require("./menuBarHandling");
const createWindow = () => {
const win = new BrowserWindow({
autoHideMenuBar: true,
webPreferences: {
spellcheck: false,
},
});
win.maximize();
session.defaultSession.setUserAgent("Chrome");
win.loadURL("https://notion.so", { userAgent: "Chrome" });
registerMenuHandling(win);
win.webContents.setWindowOpenHandler(({ url }) => {
if (!url.startsWith("https://www.notion.so")) {
shell.openExternal(url);
return { action: "deny" };
}
return { action: "allow" };
});
};
app.on("ready", () => {
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders["User-Agent"] = "Chrome";
callback({ cancel: false, requestHeaders: details.requestHeaders });
});
createWindow();
});