-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
75 lines (60 loc) · 2.01 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
71
72
73
74
75
"use strict";
require('v8-compile-cache');
const {
app,
BrowserWindow,
clipboard,
protocol,
ipcMain
} = require('electron')
const Store = require("electron-store");
const config = new Store();
const path = require("path");
// swapper from krunker FrenchChadsClient (ty azerptiop)
const Swapper = require("./script/swapper");
const cmdline = require("./init/cmdline");
const shortcuts = require("./init/shortcuts");
console.log(`cubeshotclient@${app.getVersion()} { Electron: ${process.versions.electron}, Node: ${process.versions.node}, Chromium: ${process.versions.chrome} }`);
let win;
function createWindow() {
win = new BrowserWindow({
width: 1600,
height: 900,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "/preload/global.js"),
contextIsolation: true
}
});
win.loadURL("https://cubeshot.io");
//win.webContents.openDevTools();
shortcuts(win, clipboard);
protocol.registerFileProtocol('file', (request, callback) => {
const pathname = decodeURIComponent(request.url.replace('file:///', ''));
callback(pathname);
});
protocol.registerFileProtocol("cubeshotswapper", (request, callback) => callback(decodeURI(request.url.replace(/^cubeshotswapper:/, ""))));
const swapper = new Swapper(app);
}
cmdline(app);
app.on('ready', createWindow);
ipcMain.on('settingsStore', (event, id, value) => {
config.set(id, value)
});
ipcMain.handle("get-version", () => (
app.getVersion()
));
ipcMain.handle("getSettings", () => (
win.webContents.executeJavaScript("localStorage.SettingsEvent")
));
ipcMain.handle("get-username", () => (
win.webContents.executeJavaScript("JSON.parse(localStorage.PlayerEvent).username")
));
ipcMain.handle("get-link", () => (
win.webContents.getURL()
));
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});