From df6ffd90e3160dc9583fe41039c5ec01166b982d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 28 Jun 2024 00:53:09 -0300 Subject: [PATCH] Fix broken patches --- src/plugins/_core/noTrack.ts | 27 ++++++++++++--------------- src/plugins/showHiddenThings/index.ts | 4 ++-- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/plugins/_core/noTrack.ts b/src/plugins/_core/noTrack.ts index 9283bef52..26b36735a 100644 --- a/src/plugins/_core/noTrack.ts +++ b/src/plugins/_core/noTrack.ts @@ -18,13 +18,7 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -// FIXME Do this without monkey patching maybe -Object.defineProperty(window, "DiscordSentry", { - configurable: true, - set(v) { } -}); +import definePlugin, { OptionType, StartAt } from "@utils/types"; const settings = definePluginSettings({ disableAnalytics: { @@ -52,13 +46,6 @@ export default definePlugin({ replace: "()=>{}", }, }, - { - find: "window.DiscordSentry=", - replacement: { - match: /^.+$/, - replace: "()=>{}", - } - }, { find: ".METRICS,", replacement: [ @@ -80,5 +67,15 @@ export default definePlugin({ replace: "getDebugLogging(){return false;" } }, - ] + ], + + startAt: StartAt.Init, + start() { + Object.defineProperty(window, "DiscordSentry", { + configurable: true, + set() { + Reflect.deleteProperty(window, "DiscordSentry"); + } + }); + } }); diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index b92c16c86..599bcd36d 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -110,8 +110,8 @@ export default definePlugin({ find: '"pepe","nude"', predicate: () => settings.store.disableDisallowedDiscoveryFilters, replacement: { - match: /\?\["pepe",.+?\]/, - replace: "?[]", + match: /(?<=[?=])\["pepe",.+?\]/, + replace: "[]", }, }, // patch request that queries if term is allowed