Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

Commit

Permalink
🐛 Fix bug with process.versions
Browse files Browse the repository at this point in the history
  • Loading branch information
OmegaRogue committed Sep 17, 2023
1 parent 775b1c6 commit f309f0c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,16 @@ app.whenReady().then(() => {
const password = document.querySelector('input[name="password"]');
if (password)
password.value = "${userData.password}";
const fakeEvent = {
preventDefault: () => {
}, target: document.getElementById("join-game")
}
if ("${autoLogin}" === "true") {
const fakeEvent = {
preventDefault: () => {
}, target: document.getElementById("join-game")
}
ui.join._onSubmit(fakeEvent);
} else {
document.getElementById("join-game").addEventListener("click", () => {
ui.join._onSubmit(fakeEvent);
});
}
}
Expand Down Expand Up @@ -211,8 +215,8 @@ function getLoginDetails(gameId: string): GameUserDataDecrypted {

return {
user: userData.user,
password: password.length !== 0 ? safeStorage.decryptString(Buffer.from(password)) : "",
adminPassword: password.length !== 0 ? safeStorage.decryptString(Buffer.from(adminPassword)) : "",
password: password.length !== 0 ? (safeStorage.isEncryptionAvailable() ? safeStorage.decryptString(Buffer.from(password)) : "") : "",
adminPassword: password.length !== 0 ? (safeStorage.isEncryptionAvailable() ? safeStorage.decryptString(Buffer.from(adminPassword)) : "") : "",
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/preload.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: no nodejs in preload
// eslint-disable-next-line @typescript-eslint/no-var-requires
import {contextBridge, ipcRenderer} from 'electron';
import {versions} from 'node:process';

window.addEventListener("DOMContentLoaded", () => {
const replaceText = (selector: string, text: string) => {
Expand All @@ -11,7 +11,7 @@ window.addEventListener("DOMContentLoaded", () => {
};

for (const dependency of ["chrome", "node", "electron"]) {
replaceText(`${dependency}-version`, versions[dependency]);
replaceText(`${dependency}-version`, process.versions[dependency]);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ async function createGameList() {
} catch (e) {
console.log("Failed to load config.json");
}
config = {...config, ...(JSON.parse(window.localStorage.getItem("appConfig") || "{}") as AppConfig)}
config = {...config, ...(JSON.parse(window.localStorage.getItem("appConfig") || "{}") as AppConfig)};

appVersion = await window.api.request("app-version");
appVersion = await window.api.request("app-version") as string;
document.querySelector("#current-version").textContent = appVersion;

const latestVersion: string = (await (await fetch("https://api.github.com/repos/theripper93/fvtt-player-client/releases/latest", {mode: "cors"})).json())["tag_name"];
Expand Down

0 comments on commit f309f0c

Please sign in to comment.