-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.js
41 lines (35 loc) · 1.18 KB
/
renderer.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');
const { ipcRenderer, shell } = electron;
const path = require('path');
let platform = ''
let version = ''
// Get process info
ipcRenderer.invoke('app-platform').then((arg) => {
platform = arg
ipcRenderer.invoke('app-version').then((arg) => {
version = arg
console.log('Installed app version: ' + version)
console.log('Platform: ' + platform)
localStorage.setItem('platform', platform)
checkForUpdates()
})
})
const webview = document.getElementById('inbox');
webview.addEventListener('new-window', async (e) => {
const protocol = (new URL(e.url)).protocol
if (protocol === 'http:' || protocol === 'https:') {
await shell.openExternal(e.url)
}
})
// Inject custom CSS
webview.addEventListener('dom-ready', function () {
// Change Useragent to Chrome in order to avoid the app being blocked by Google
webview.setUserAgent('Mozilla/5.0 (X11; Linux i686; rv:82.0) Gecko/20100101 Firefox/82.0')
})
// Set zoom level
ipcRenderer.on('zoomin', () => {
document.getElementById('inbox').setZoomFactor(1)
})
ipcRenderer.on('zoomout', () => {
document.getElementById('inbox').setZoomFactor(0.9)
})