-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
82 lines (63 loc) · 1.8 KB
/
main.js
File metadata and controls
82 lines (63 loc) · 1.8 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
const { app, BrowserWindow, ipcMain } = require('electron');
const { autoUpdater } = require('electron-updater');
const electron = require('electron');
const path = require('path');
const WindowsInetBridge = require('./src/core/SSL/WindowsInetBridge');
let mainWindow;
function createWindow () {
mainWindow = new BrowserWindow({
width: 600,
height: 400,
resizable: false,
alwaysOnTop: false,
webPreferences:{
nodeIntegration: true,
nodeIntegrationInWorker: true,
enableRemoteModule: true
},
icon: path.join(__dirname, 'icon.png')
});
//mainWindow.setMenu(null);
mainWindow.loadURL(`file://${__dirname}/src/view/index.html`);
// Open the DevTools.
// mainWindow.webContents.openDevTools();
mainWindow.on('closed', () => {
mainWindow = null;
let windowsInetBridge = new WindowsInetBridge();
windowsInetBridge.disableProxy();
process.exit(0);
});
}
app.on('ready', () => {
createWindow();
});
app.on('window-all-closed', () => {
app.quit();
});
app.on('activate', () => {
if (mainWindow === null) {
createWindow();
}
});
app.allowRendererProcessReuse = false;
ipcMain.on('check_update', () => {
autoUpdater.checkForUpdatesAndNotify();
});
ipcMain.on('update_app', () => {
autoUpdater.quitAndInstall();
});
autoUpdater.on('update-available', () => {
mainWindow.webContents.send('update_available');
});
autoUpdater.on('update-not-available', () => {
mainWindow.webContents.send('update_not_available');
});
autoUpdater.on('checking-for-update', () => {
mainWindow.webContents.send('checking_for_update');
});
autoUpdater.on('update-downloaded', () => {
mainWindow.webContents.send('update_downloaded');
});
autoUpdater.on('error', error => {
mainWindow.webContents.send('update_error', error);
});