-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.js
43 lines (37 loc) · 1.06 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
const { app, BrowserWindow, ipcMain } = require("electron");
const child = require("child_process").execFile;
const public = require("path").join(__dirname, "/src/public");
const ext = require("path").join(__dirname, "/src/ext");
console.log(ext);
// require("electron-reload")(public, {
// electron: require(`${__dirname}/node_modules/electron`),
// });
let win;
function createWindow() {
win = new BrowserWindow({
width: 400,
height: 600,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
resizable: false,
});
void win.loadFile(public + "/index.html");
// win.webContents.openDevTools();
}
app.on("ready", () => {
createWindow();
});
app.on("window-all-closed", async () => {
const sysproxy = ext + "/sysproxy.exe";
await child(sysproxy, ["set", "1"], function (err, data) {});
app.quit();
});
ipcMain.on("loginSuccess", (event, agr) => {
void win.loadFile(public + "/node.html");
});
ipcMain.on("backToLogin", (event, agr) => {
void win.loadFile(public + "/index.html");
});