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 }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener("autologin-attempt", async (e) => {
|
|
|
|
const loginResult = await ipcRenderer.invoke("ezpplauncher:autologin");
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent("login-result", { detail: loginResult }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener("logout", async (e) => {
|
|
|
|
await ipcRenderer.invoke("ezpplauncher:logout");
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener("guest-login", async (e) => {
|
|
|
|
await ipcRenderer.invoke("ezpplauncher:guestlogin");
|
|
|
|
});
|