-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
70 lines (61 loc) · 1.83 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
60
61
62
63
64
65
66
67
68
69
70
const { app, shell, session, BrowserWindow, Menu, } = require('electron')
const path = require('path')
const config = {
useContentSize: true,
width: 1281,
height: 800,
center: true,
// backgroundColor: '#fff',
title: 'Microsoft Teams M1',
icon: path.resolve(__dirname, 'assets/icons/png/256x256.png'),
show: true,
autoHideMenuBar: true,
webPreferences: {
devTools: true,
// webSecurity: true,
// nodeIntegration: true,
allowDisplayingInsecureContent: true,
allowRunningInsecureContent: true,
plugins: true,
preload: path.resolve(__dirname, 'src/preload.js'),
sandbox: false,
},
}
app.on('ready', function () {
Menu.setApplicationMenu(Menu.buildFromTemplate(require('./src/menu')))
session.defaultSession.clearStorageData(null, () => {
// in our case we need to restart the application
app.relaunch()
app.exit()
})
let mainWindow = new BrowserWindow(config)
mainWindow.setTitle(require('./package.json').description)
mainWindow.on('reload', () => {
session.defaultSession.clearStorageData(null, () => {
// in our case we need to restart the application
app.relaunch()
app.exit()
})
})
mainWindow.on('close', function (e) {
const choice = require('electron').dialog.showMessageBoxSync(this,
{
type: 'question',
buttons: [ 'Yes', 'No', ],
title: 'Confirm',
message: 'Are you sure you want to quit?',
})
if (choice === 1) {
e.preventDefault()
}
})
mainWindow.loadURL('https://teams.microsoft.com', {
userAgent:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
})
mainWindow.webContents.on('new-window', function (event, url) {
event.preventDefault()
shell.openExternal(url)
})
mainWindow.show()
})