-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.js
41 lines (33 loc) · 1.21 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
const electron = require('electron')
// Initialise application
electron.app.whenReady().then(function() {
// Create a new window
var window = new electron.BrowserWindow({
width: 1000,
height: 1000,
webPreferences: {
nativeWindowOpen: true
}
});
// Specify user agent so "download iCloud for Windows" banner doesn't appear
electron.session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders['User-Agent'] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15";
callback({
cancel: false,
requestHeaders: details.requestHeaders
});
});
// Hide default top menu
window.setMenu(null);
// Make links set to open a new tab and window.open() open in the default browser instead of a new application window
window.webContents.on("new-window", function(event, url) {
event.preventDefault();
if (url !== "about:blank#blocked") electron.shell.openExternal(url);
});
// Load the iCloud notes page
window.loadURL("https://www.icloud.com");
});
// Quit when all windows closed
electron.app.on('window-all-closed', function() {
electron.app.quit();
});