2024-01-09 12:10:37 +00:00
|
|
|
const { Titlebar, TitlebarColor } = require("custom-electron-titlebar");
|
2024-01-11 00:00:43 +00:00
|
|
|
const { ipcRenderer } = require("electron");
|
2024-01-09 12:10:37 +00:00
|
|
|
|
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
|
|
const titlebar = new Titlebar({
|
|
|
|
backgroundColor: TitlebarColor.fromHex("#202020"),
|
|
|
|
itemBackgroundColor: TitlebarColor.fromHex("#202020"),
|
|
|
|
menu: null,
|
|
|
|
enableMnemonics: false,
|
|
|
|
maximizable: false,
|
|
|
|
});
|
|
|
|
});
|
2024-01-11 00:00:43 +00:00
|
|
|
|
|
|
|
window.addEventListener("login-attempt", async (e) => {
|
|
|
|
const loginResult = await ipcRenderer.invoke("ezpplauncher:login", {
|
|
|
|
username: e.detail.username,
|
|
|
|
password: e.detail.password,
|
2024-01-11 11:59:52 +00:00
|
|
|
saveCredentials: e.detail.saveCredentials,
|
2024-01-11 00:00:43 +00:00
|
|
|
});
|
2024-01-11 11:59:52 +00:00
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("login-result", { detail: loginResult }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2024-01-12 13:19:00 +00:00
|
|
|
window.addEventListener("autologin-attempt", async () => {
|
2024-01-11 11:59:52 +00:00
|
|
|
const loginResult = await ipcRenderer.invoke("ezpplauncher:autologin");
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("login-result", { detail: loginResult }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2024-01-12 13:19:00 +00:00
|
|
|
window.addEventListener("logout", async () => {
|
2024-01-11 11:59:52 +00:00
|
|
|
await ipcRenderer.invoke("ezpplauncher:logout");
|
|
|
|
});
|
|
|
|
|
2024-01-12 13:19:00 +00:00
|
|
|
window.addEventListener("guest-login", async () => {
|
2024-01-11 11:59:52 +00:00
|
|
|
await ipcRenderer.invoke("ezpplauncher:guestlogin");
|
|
|
|
});
|
2024-01-12 11:09:28 +00:00
|
|
|
|
2024-01-13 22:41:40 +00:00
|
|
|
window.addEventListener("launch", async (e) => {
|
|
|
|
await ipcRenderer.invoke("ezpplauncher:launch", e.detail);
|
2024-01-12 11:09:28 +00:00
|
|
|
});
|
|
|
|
|
2024-01-12 13:19:00 +00:00
|
|
|
window.addEventListener("settings-get", async () => {
|
|
|
|
const settings = await ipcRenderer.invoke("ezpplauncher:settings");
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("settings-result", { detail: settings }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener("folder-set", async (e) => {
|
|
|
|
const result = await ipcRenderer.invoke("ezpplauncher:set-folder");
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("settings-result", { detail: result }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener("settings-set", async (e) => {
|
|
|
|
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
|
|
|
});
|
|
|
|
|
2024-01-12 15:10:19 +00:00
|
|
|
ipcRenderer.addListener("ezpplauncher:launchabort", (e, args) => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("launch-abort"),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2024-01-12 13:19:00 +00:00
|
|
|
ipcRenderer.addListener("ezpplauncher:alert", (e, args) => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("alert", { detail: args }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2024-01-12 11:09:28 +00:00
|
|
|
ipcRenderer.addListener("ezpplauncher:launchstatus", (e, args) => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("launchStatusUpdate", { detail: args }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
ipcRenderer.addListener("ezpplauncher:launchprogress", (e, args) => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("launchProgressUpdate", { detail: args }),
|
|
|
|
);
|
|
|
|
});
|