From b9bf19f0594aa7b0c850cc057290af1f495d3549 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Wed, 15 May 2024 20:32:14 +0200 Subject: [PATCH] simplify version api --- src/common/version.ts | 19 +++++++------------ src/discord/ipc.ts | 5 +---- src/discord/preload/bridge.mts | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/common/version.ts b/src/common/version.ts index 57cd634..57055dd 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1,19 +1,14 @@ import {app} from "electron"; -export const packageVersion = "3.2.0"; - export function getVersion(): string { - return packageVersion; + if ((app.getVersion() == process.versions.electron) == true) { + return "3.3.0"; + } + return app.getVersion(); } export function getDisplayVersion(): string { - //Checks if the app version # has 4 sections (3.1.0.0) instead of 3 (3.1.0) / Shitty way to check if Kernel Mod is installed - if ((app.getVersion() == packageVersion) == false) { - if ((app.getVersion() == process.versions.electron) == true) { - return `Dev Build (${packageVersion})`; - } else { - return `${packageVersion} [Modified]`; - } - } else { - return packageVersion; + if ((app.getVersion() == process.versions.electron) == true) { + return "Dev Build"; } + return app.getVersion(); } diff --git a/src/discord/ipc.ts b/src/discord/ipc.ts index dc33a49..cd22294 100644 --- a/src/discord/ipc.ts +++ b/src/discord/ipc.ts @@ -8,7 +8,7 @@ import path from "path"; import {getConfig, setConfigBulk, getConfigLocation, Settings} from "../common/config"; import {setLang, getLang, getLangName} from "../common/lang"; import {sleep} from "../common/sleep"; -import {getVersion, getDisplayVersion, packageVersion} from "../common/version"; +import {getVersion, getDisplayVersion} from "../common/version"; import {customTitlebar} from "../main"; import {createSettingsWindow} from "../settings/main"; import {splashWindow} from "../splash/main"; @@ -80,9 +80,6 @@ export function registerIpc(): void { ipcMain.on("modInstallState", (event) => { event.returnValue = modInstallState; }); - ipcMain.on("get-package-version", (event) => { - event.returnValue = packageVersion; - }); ipcMain.on("splashEnd", async () => { splashWindow.close(); if (await getConfig("startMinimized")) { diff --git a/src/discord/preload/bridge.mts b/src/discord/preload/bridge.mts index ab52faa..b055872 100644 --- a/src/discord/preload/bridge.mts +++ b/src/discord/preload/bridge.mts @@ -57,7 +57,6 @@ contextBridge.exposeInMainWorld("armcord", { getDisplayMediaSelector, version: ipcRenderer.sendSync("get-app-version", "app-version"), mods: ipcRenderer.sendSync("clientmod"), - packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"), openSettingsWindow: () => ipcRenderer.send("openSettingsWindow") }); let windowCallback: (arg0: object) => void;