diff --git a/browser/VencordNativeStub.ts b/browser/VencordNativeStub.ts index 46cba9d0c..139bcd972 100644 --- a/browser/VencordNativeStub.ts +++ b/browser/VencordNativeStub.ts @@ -139,5 +139,6 @@ window.VencordNative = { setUpdateState: NOOP, onCheckUpdates: NOOP, onRepair: NOOP, + onAbout: NOOP, }, }; diff --git a/src/VencordNative.ts b/src/VencordNative.ts index d13ce4dd7..7835e84c2 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -102,6 +102,7 @@ export default { setUpdateState: (available: boolean) => ipcRenderer.send(IpcEvents.SET_TRAY_UPDATE_STATE, available), onCheckUpdates: (cb: () => void) => { ipcRenderer.on(IpcEvents.TRAY_CHECK_UPDATES, cb); }, onRepair: (cb: () => void) => { ipcRenderer.on(IpcEvents.TRAY_REPAIR, cb); }, + onAbout: (cb: () => void) => { ipcRenderer.on(IpcEvents.TRAY_ABOUT, cb); }, }, pluginHelpers: PluginHelpers diff --git a/src/main/about.html b/src/main/about.html new file mode 100644 index 000000000..555c60d71 --- /dev/null +++ b/src/main/about.html @@ -0,0 +1,133 @@ + + + + + About Equicord + + + + +

Equicord v{{VERSION}} ({{GIT_HASH}})

+

+ Equicord is the unstable experimental FORK + of Vencord and the other cutest client mod. +

+
+

Links

+ +
+
+

License

+

+ Equicord is licensed under the + GNU General Public License v3.0. +
+ This is free software, and you are welcome to redistribute it under certain conditions; see the license for + details. +

+
+
+

Acknowledgements

+

These awesome libraries/projects empower Equicord

+ +
+ + \ No newline at end of file diff --git a/src/main/trayMenu.ts b/src/main/trayMenu.ts index 3f7cc51ae..32bde1cb5 100644 --- a/src/main/trayMenu.ts +++ b/src/main/trayMenu.ts @@ -5,9 +5,11 @@ */ import { IpcEvents } from "@shared/IpcEvents"; +import { gitHashShort } from "@shared/vencordUserAgent"; import { BrowserWindow, ipcMain, Menu, MenuItemConstructorOptions, shell } from "electron"; +import aboutHtml from "file://about.html?minify"; -import { SETTINGS_DIR } from "./utils/constants"; +import { SETTINGS_DIR, THEMES_DIR } from "./utils/constants"; let cachedUpdateAvailable = false; @@ -51,11 +53,41 @@ function isTrayMenu(template: MenuItemConstructorOptions[]): boolean { return hasOpenOrShow && hasQuit && isNotAppMenu; } +let aboutWindow: BrowserWindow | null = null; + +function openAboutWindow() { + if (aboutWindow) { + aboutWindow.focus(); + return; + } + + const height = 750; + const width = height * (4 / 3); + + aboutWindow = new BrowserWindow({ + center: true, + autoHideMenuBar: true, + height, + width + }); + + const aboutParams = aboutHtml.replace("{{VERSION}}", VERSION).replace("{{GIT_HASH}}", gitHashShort); + const base64Html = Buffer.from(aboutParams).toString("base64"); + aboutWindow.loadURL(`data:text/html;base64,${base64Html}`); + aboutWindow.on("closed", () => { + aboutWindow = null; + }); +} + function createEquicordMenuItems(): MenuItemConstructorOptions[] { return [ { label: "Equicord", submenu: [ + { + label: "About Equicord", + click: () => openAboutWindow() + }, { label: cachedUpdateAvailable ? "Update Equicord" : "Check for Updates", click: () => sendToRenderer(IpcEvents.TRAY_CHECK_UPDATES) @@ -68,6 +100,10 @@ function createEquicordMenuItems(): MenuItemConstructorOptions[] { { label: "Open Settings Folder", click: () => shell.openPath(SETTINGS_DIR) + }, + { + label: "Open Themes Folder", + click: () => shell.openPath(THEMES_DIR) } ] }, diff --git a/src/shared/IpcEvents.ts b/src/shared/IpcEvents.ts index 2a4455eac..eda8c407b 100644 --- a/src/shared/IpcEvents.ts +++ b/src/shared/IpcEvents.ts @@ -55,4 +55,5 @@ export const enum IpcEvents { SET_TRAY_UPDATE_STATE = "VencordSetTrayUpdateState", TRAY_REPAIR = "VencordTrayRepair", TRAY_CHECK_UPDATES = "VencordTrayCheckUpdates", + TRAY_ABOUT = "VencordTrayAbout" }