From e6c1a03c5955f8dff8ed741c59f5c9359afc7887 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 8 Feb 2025 03:53:33 +0100 Subject: [PATCH] Revert "use Vencord's addPatch instead of manually adding patches" This was pushed prematurely since it depends on a change to Vencord that hasn't been released yet This reverts commit 68930a1f505a12e76ceeb0671e3973cdd7f81a92. --- src/globals.d.ts | 2 +- src/renderer/patches/shared.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/globals.d.ts b/src/globals.d.ts index 0795c71..6d95b92 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -7,7 +7,7 @@ declare global { export var VesktopNative: typeof import("preload/VesktopNative").VesktopNative; export var Vesktop: typeof import("renderer/index"); - export var VesktopPatchGlobals: any; + export var VCDP: any; export var IS_DEV: boolean; } diff --git a/src/renderer/patches/shared.ts b/src/renderer/patches/shared.ts index 035ff41..dd8952e 100644 --- a/src/renderer/patches/shared.ts +++ b/src/renderer/patches/shared.ts @@ -6,7 +6,7 @@ import { Patch } from "@vencord/types/utils/types"; -window.VesktopPatchGlobals = {}; +window.VCDP = {}; interface PatchData { patches: Omit[]; @@ -16,11 +16,15 @@ interface PatchData { export function addPatch

(p: P) { const { patches, ...globals } = p; - for (const patch of patches) { - // @ts-expect-error outdated types don't have addPatch yet - // TODO: Update types - Vencord.Plugins.addPatch(patch, "Vesktop", "VesktopPatchGlobals"); + for (const patch of patches as Patch[]) { + if (!Array.isArray(patch.replacement)) patch.replacement = [patch.replacement]; + for (const r of patch.replacement) { + if (typeof r.replace === "string") r.replace = r.replace.replaceAll("$self", "VCDP"); + } + + patch.plugin = "Vesktop"; + Vencord.Plugins.patches.push(patch); } - Object.assign(VesktopPatchGlobals, globals); + Object.assign(VCDP, globals); }