this is broken

This commit is contained in:
thororen1234 2026-02-26 10:27:06 -05:00
parent 175a5ff2c0
commit 8990f7a44d
No known key found for this signature in database
6 changed files with 14 additions and 67 deletions

View file

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

View file

@ -19439,4 +19439,4 @@
"FD9mUy": "DESKTOP_DOWNLOAD_TITLE_LINUX", "FD9mUy": "DESKTOP_DOWNLOAD_TITLE_LINUX",
"hmGBzx": "DESKTOP_DOWNLOAD_TITLE_MAC", "hmGBzx": "DESKTOP_DOWNLOAD_TITLE_MAC",
"GY/qwb": "DESKTOP_DOWNLOAD_TITLE_WINDOWS" "GY/qwb": "DESKTOP_DOWNLOAD_TITLE_WINDOWS"
} }

View file

@ -37,14 +37,14 @@ 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 { getCloudSettings, putCloudSettings, shouldCloudSync } from "./api/SettingsSync/cloudSync"; import { getCloudSettings, putCloudSettings, shouldCloudSync } from "./api/SettingsSync/cloudSync";
import { localStorage } from "./utils/localStorage"; import { localStorage } from "./utils/localStorage";
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";
@ -141,7 +141,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) {
@ -172,43 +171,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,12 +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); },
onAbout: (cb: () => void) => { ipcRenderer.on(IpcEvents.TRAY_ABOUT, 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"
} }