-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
69 lines (61 loc) · 1.69 KB
/
index.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
require("v8-compile-cache");
require( "@electron/remote/main" ).initialize();
const {
app,
BrowserWindow,
globalShortcut,
} = require( "electron" );
const express = require( "express" );
const server = express();
server.use(express.static( __dirname ));
const debug = true;
const port = 3000;
app.on( "window-all-closed", () => app.quit() );
app.on(
"ready", () => {
console.log(
"\x1B[0m" + new Date().toLocaleTimeString() + " \x1B[33m\x1B[1m[INFO] \x1B[0m- Starting."
);
if (!debug) registerShortcuts();
server.listen(
port, () => {
console.log(
"\x1B[0m" + new Date().toLocaleTimeString() + " \x1B[33m\x1B[1m[INFO] \x1B[0m- The server is now running on port \x1B[33m" + port + "\x1B[0m!",
);
createWindow();
},
);
},
);
const registerShortcuts = () => {
globalShortcut.register( "Control+R", () => false );
globalShortcut.register( "Control+Shift+R", () => false );
};
const createWindow = () => {
console.log(
"\x1B[0m" + new Date().toLocaleTimeString() + " \x1B[33m\x1B[1m[INFO] \x1B[0m- Creating the window"
);
const win = new BrowserWindow({
minWidth: 1010,
minHeight: 640,
width: 1070,
height: 648,
title: "Minecraft - OreUI",
icon: "./src/assets/mcpreview.png",
autoHideMenuBar: true,
resizable: true,
webPreferences: {
preload: __dirname + "/engine.js",
devTools: debug,
webgl: true,
webSecurity: true,
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
});
require( "@electron/remote/main" ).enable( win.webContents );
app.setAppUserModelId( "Minecraft - OreUI" );
win.show();
win.loadURL( "http://127.0.0.1:3000/hbui" );
};