Compare commits

...
Sign in to create a new pull request.

9 commits

Author SHA1 Message Date
thororen1234
dccaf6274e
Merge branch 'dev' into tray-stuff
All checks were successful
Build Branches / Build Equicord (push) Has been skipped
2026-05-07 11:54:35 -04:00
thororen1234
03006efd08
Merge branch 'dev' into tray-stuff 2026-05-07 11:32:45 -04:00
thororen1234
0974da2532
Merge branch 'dev' into tray-stuff 2026-04-10 07:46:03 -04:00
thororen1234
b8a9181c32
Merge branch 'dev' into tray-stuff 2026-04-09 18:16:52 -04:00
thororen1234
bc87f72421
Merge branch 'dev' into tray-stuff 2026-03-06 21:15:22 -05:00
thororen1234
cd5e142116
Merge branch 'dev' into tray-stuff 2026-03-02 17:28:22 -05:00
thororen1234
a43d15deb3
Merge branch 'dev' into tray-stuff 2026-03-02 17:25:35 -05:00
thororen1234
3f0263575c
Merge branch 'dev' into tray-stuff 2026-02-26 11:38:03 -05:00
thororen1234
8990f7a44d
this is broken 2026-02-26 10:27:06 -05:00
6 changed files with 14 additions and 65 deletions

View file

@ -135,9 +135,4 @@ window.VencordNative = {
pluginHelpers: {} as any, pluginHelpers: {} as any,
csp: {} as any, csp: {} as any,
tray: {
setUpdateState: NOOP,
onCheckUpdates: NOOP,
onRepair: NOOP,
},
}; };

View file

@ -37,13 +37,13 @@ import { StartAt } from "@utils/types";
import { SettingsRouter } from "@webpack/common"; import { SettingsRouter } from "@webpack/common";
import { get as dsGet } from "./api/DataStore"; import { get as dsGet } from "./api/DataStore";
import { popNotice, showNotice } from "./api/Notices"; import { showNotice } from "./api/Notices";
import { NotificationData, showNotification } from "./api/Notifications"; import { NotificationData, showNotification } from "./api/Notifications";
import { initPluginManager, PMLogger, startAllPlugins } from "./api/PluginManager"; import { initPluginManager, PMLogger, startAllPlugins } from "./api/PluginManager";
import { PlainSettings, Settings, SettingsStore } from "./api/Settings"; import { PlainSettings, Settings, SettingsStore } from "./api/Settings";
import { areLocalSettingsDirty, getCloudSettings, getCloudSyncDirection, markLocalSettingsDirty, putCloudSettings, shouldCloudSync } from "./api/SettingsSync/cloudSync"; import { areLocalSettingsDirty, getCloudSettings, getCloudSyncDirection, markLocalSettingsDirty, putCloudSettings, shouldCloudSync } from "./api/SettingsSync/cloudSync";
import { relaunch } from "./utils/native"; import { relaunch } from "./utils/native";
import { checkForUpdates, isOutdated as getIsOutdated, update, UpdateLogger } from "./utils/updater"; import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack"; import { onceReady } from "./webpack";
import { patches } from "./webpack/patchWebpack"; import { patches } from "./webpack/patchWebpack";
@ -135,7 +135,6 @@ async function runUpdateCheck() {
try { try {
const isOutdated = await checkForUpdates(); const isOutdated = await checkForUpdates();
if (IS_DISCORD_DESKTOP) VencordNative.tray.setUpdateState(isOutdated);
if (!isOutdated) return; if (!isOutdated) return;
if (Settings.autoUpdate) { if (Settings.autoUpdate) {
@ -166,43 +165,11 @@ async function runUpdateCheck() {
} }
} }
function initTrayIpc() {
if (IS_WEB || IS_UPDATER_DISABLED) return;
VencordNative.tray.onCheckUpdates(async () => {
try {
const isOutdated = await checkForUpdates();
VencordNative.tray.setUpdateState(isOutdated);
if (isOutdated) {
showNotice("An Equicord update is available!", "View Update", () => openSettingsTabModal(UpdaterTab!));
} else {
showNotice("No updates available, you're on the latest version!", "OK", popNotice);
}
} catch (err) {
UpdateLogger.error("Failed to check for updates from tray", err);
showNotice("Failed to check for updates, check the console for more info", "OK", popNotice);
}
});
VencordNative.tray.onRepair(async () => {
try {
await update();
relaunch();
} catch (err) {
UpdateLogger.error("Failed to repair Equicord", err);
}
});
VencordNative.tray.setUpdateState(getIsOutdated);
}
async function init() { async function init() {
await onceReady; await onceReady;
startAllPlugins(StartAt.WebpackReady); startAllPlugins(StartAt.WebpackReady);
syncSettings(); syncSettings();
initTrayIpc();
if (!IS_DEV && !IS_WEB && !IS_UPDATER_DISABLED) { if (!IS_DEV && !IS_WEB && !IS_UPDATER_DISABLED) {
runUpdateCheck(); runUpdateCheck();

View file

@ -98,11 +98,5 @@ export default {
invoke<CspRequestResult>(IpcEvents.CSP_REQUEST_ADD_OVERRIDE, url, directives, callerName), invoke<CspRequestResult>(IpcEvents.CSP_REQUEST_ADD_OVERRIDE, url, directives, callerName),
}, },
tray: {
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); },
},
pluginHelpers: PluginHelpers pluginHelpers: PluginHelpers
}; };

View file

@ -6,17 +6,11 @@
import { IpcEvents } from "@shared/IpcEvents"; import { IpcEvents } from "@shared/IpcEvents";
import { gitHashShort } from "@shared/vencordUserAgent"; import { gitHashShort } from "@shared/vencordUserAgent";
import { BrowserWindow, ipcMain, Menu, MenuItemConstructorOptions, shell } from "electron"; import { BrowserWindow, Menu, MenuItemConstructorOptions, shell } from "electron";
import aboutHtml from "file://about.html?minify"; import aboutHtml from "file://about.html?minify";
import { SETTINGS_DIR, THEMES_DIR } from "./utils/constants"; import { SETTINGS_DIR, THEMES_DIR } from "./utils/constants";
let cachedUpdateAvailable = false;
ipcMain.on(IpcEvents.SET_TRAY_UPDATE_STATE, (_, available: boolean) => {
cachedUpdateAvailable = available;
});
function getMainWindow(): BrowserWindow | undefined { function getMainWindow(): BrowserWindow | undefined {
return BrowserWindow.getFocusedWindow() ?? BrowserWindow.getAllWindows()[0]; return BrowserWindow.getFocusedWindow() ?? BrowserWindow.getAllWindows()[0];
} }
@ -101,12 +95,16 @@ function createEquicordMenuItems(): MenuItemConstructorOptions[] {
click: () => openAboutWindow() click: () => openAboutWindow()
}, },
{ {
label: cachedUpdateAvailable ? "Update Equicord" : "Check for Updates", label: "Update Equicord",
click: () => sendToRenderer(IpcEvents.TRAY_CHECK_UPDATES) click: async () => {
}, try {
{ sendToRenderer(IpcEvents.GET_UPDATES);
label: "Repair Equicord", sendToRenderer(IpcEvents.UPDATE);
click: () => sendToRenderer(IpcEvents.TRAY_REPAIR) sendToRenderer(IpcEvents.BUILD);
} catch (err) {
console.error("Failed to check updates from tray", err);
}
}
}, },
{ type: "separator" }, { type: "separator" },
{ {

View file

@ -51,9 +51,4 @@ export const enum IpcEvents {
GET_RENDERER_CSS = "VencordGetRendererCss", GET_RENDERER_CSS = "VencordGetRendererCss",
RENDERER_CSS_UPDATE = "VencordRendererCssUpdate", RENDERER_CSS_UPDATE = "VencordRendererCssUpdate",
PRELOAD_GET_RENDERER_JS = "VencordPreloadGetRendererJs", PRELOAD_GET_RENDERER_JS = "VencordPreloadGetRendererJs",
SET_TRAY_UPDATE_STATE = "VencordSetTrayUpdateState",
TRAY_REPAIR = "VencordTrayRepair",
TRAY_CHECK_UPDATES = "VencordTrayCheckUpdates",
TRAY_ABOUT = "VencordTrayAbout"
} }