From 748a456cfb973cdfcae92d5f342bfba6b3762183 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:54:37 -0300 Subject: [PATCH 1/4] Delete patching properties after used --- src/plugins/_core/noTrack.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/_core/noTrack.ts b/src/plugins/_core/noTrack.ts index ef2849bbc..b94a91092 100644 --- a/src/plugins/_core/noTrack.ts +++ b/src/plugins/_core/noTrack.ts @@ -114,6 +114,7 @@ export default definePlugin({ } })); + Reflect.deleteProperty(Function.prototype, "g"); Reflect.deleteProperty(Object.prototype, cacheExtractSym); Reflect.deleteProperty(window, "DiscordSentry"); return { exports: {} }; @@ -130,6 +131,7 @@ export default definePlugin({ set() { new Logger("NoTrack", "#8caaee").error("Failed to disable Sentry. Falling back to deleting window.DiscordSentry"); + Reflect.deleteProperty(Function.prototype, "g"); Reflect.deleteProperty(window, "DiscordSentry"); } }); From f969d80dc3da915080a8e8190e575ee8c9841a07 Mon Sep 17 00:00:00 2001 From: Lillith Date: Fri, 28 Jun 2024 17:57:28 -0400 Subject: [PATCH 2/4] feat(plugin): DefaultStatusForever --- src/plugins/defaultStatusForever/README.md | 5 +++ src/plugins/defaultStatusForever/index.tsx | 48 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/plugins/defaultStatusForever/README.md create mode 100644 src/plugins/defaultStatusForever/index.tsx diff --git a/src/plugins/defaultStatusForever/README.md b/src/plugins/defaultStatusForever/README.md new file mode 100644 index 000000000..89b2bcdc0 --- /dev/null +++ b/src/plugins/defaultStatusForever/README.md @@ -0,0 +1,5 @@ +# DefaultStatusForever + +Makes the custom status screen default to "Don't Clear" as the duration + +![The custom status screen, with "Don't Clear" selected and as the first option](https://github.com/Vendicated/Vencord/assets/44179559/e8cf0ca1-589c-43ef-9a6d-4fa3ed03a1f9) diff --git a/src/plugins/defaultStatusForever/index.tsx b/src/plugins/defaultStatusForever/index.tsx new file mode 100644 index 000000000..27a7752b4 --- /dev/null +++ b/src/plugins/defaultStatusForever/index.tsx @@ -0,0 +1,48 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +interface Choice { + key: number; + value: any; + label: string; +} + +export default definePlugin({ + name: "DefaultStatusForever", + description: "Make statuses default to last forever", + authors: [Devs.ImLvna], + + patches: [ + { + // hardcode default status duration to null + find: "this.clearAfterOptions", + replacement: { + match: /(?<=value:)\i(?=,options:this.clearAfterOptions)/, + replace: "null" + } + }, + { + // reorder the list to put "Dont't Clear" at the top + find: "get clearAfterOptions", + replacement: { + match: /(?<=get clearAfterOptions\(\){return).*?}]/, + replace: " $self.patchChoices($&)" + } + } + ], + + patchChoices(choices: Choice[]) { + const nullChoice = choices.find(choice => choice.value === null); + if (nullChoice) { + choices.splice(choices.indexOf(nullChoice), 1); + choices.unshift(nullChoice); + } + return choices; + } +}); From cd8729700ecb119646c4d967fd0f5bdb13e2b9a1 Mon Sep 17 00:00:00 2001 From: Lillith Date: Fri, 28 Jun 2024 18:02:54 -0400 Subject: [PATCH 3/4] fix: accidentally used tsx extension --- src/plugins/defaultStatusForever/{index.tsx => index.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/plugins/defaultStatusForever/{index.tsx => index.ts} (100%) diff --git a/src/plugins/defaultStatusForever/index.tsx b/src/plugins/defaultStatusForever/index.ts similarity index 100% rename from src/plugins/defaultStatusForever/index.tsx rename to src/plugins/defaultStatusForever/index.ts From f9dec90f347e67902458e1c13020eff6604996c0 Mon Sep 17 00:00:00 2001 From: vee Date: Fri, 5 Jul 2024 18:49:14 +0200 Subject: [PATCH 4/4] Discard changes to src/plugins/_core/noTrack.ts --- src/plugins/_core/noTrack.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/_core/noTrack.ts b/src/plugins/_core/noTrack.ts index b94a91092..ef2849bbc 100644 --- a/src/plugins/_core/noTrack.ts +++ b/src/plugins/_core/noTrack.ts @@ -114,7 +114,6 @@ export default definePlugin({ } })); - Reflect.deleteProperty(Function.prototype, "g"); Reflect.deleteProperty(Object.prototype, cacheExtractSym); Reflect.deleteProperty(window, "DiscordSentry"); return { exports: {} }; @@ -131,7 +130,6 @@ export default definePlugin({ set() { new Logger("NoTrack", "#8caaee").error("Failed to disable Sentry. Falling back to deleting window.DiscordSentry"); - Reflect.deleteProperty(Function.prototype, "g"); Reflect.deleteProperty(window, "DiscordSentry"); } });