From 414539f45ecc24bf78878a76de0569f6d14ab375 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:01:57 -0300 Subject: [PATCH] Add more FIXME and explain better TODOS for migrations --- src/plugins/_api/chatButtons.ts | 1 + src/plugins/_core/settings.tsx | 1 + src/plugins/ctrlEnterSend/index.ts | 1 + src/plugins/fakeNitro/index.tsx | 1 + src/plugins/messageTags/index.ts | 2 +- src/plugins/openInApp/index.ts | 1 + src/plugins/permissionFreeWill/index.ts | 1 + src/plugins/pinDms/data.ts | 2 +- src/plugins/showHiddenChannels/index.tsx | 4 ++++ src/plugins/textReplace/index.tsx | 2 +- 10 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/_api/chatButtons.ts b/src/plugins/_api/chatButtons.ts index 86ca195e0..184b01584 100644 --- a/src/plugins/_api/chatButtons.ts +++ b/src/plugins/_api/chatButtons.ts @@ -16,6 +16,7 @@ export default definePlugin({ { find: '"sticker")', replacement: { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /return\((!)?\i\.\i(?:\|\||&&)(?=\(\i\.isDM.+?(\i)\.push)/, replace: (m, not, children) => not ? `${m}(Vencord.Api.ChatButtons._injectButtons(${children},arguments[0]),true)&&` diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 75fa91470..f48f38e03 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -65,6 +65,7 @@ export default definePlugin({ replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}` }, { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /({(?=.+?function (\i).{0,160}(\i)=\i\.useMemo.{0,140}return \i\.useMemo\(\(\)=>\i\(\3).+?(?:function\(\){return |\(\)=>))\2/, replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})` } diff --git a/src/plugins/ctrlEnterSend/index.ts b/src/plugins/ctrlEnterSend/index.ts index 67db12abc..b24f7a909 100644 --- a/src/plugins/ctrlEnterSend/index.ts +++ b/src/plugins/ctrlEnterSend/index.ts @@ -44,6 +44,7 @@ export default definePlugin({ { find: ".selectPreviousCommandOption(", replacement: { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(?<=(\i)\.which(?:!==|===)\i\.\i.ENTER(\|\||&&)).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=(?:\|\||&&)\(\i\.preventDefault)/, replace: (_, event, condition, codeblock) => `${condition === "||" ? "!" : ""}$self.shouldSubmit(${event},${codeblock})` } diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 020ff67c2..4bdf194ce 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -256,6 +256,7 @@ export default definePlugin({ }, { // Disallow the emoji for premium locked if the intention doesn't allow it + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(!)?(\i\.\i\.canUseEmojisEverywhere\(\i\))/, replace: (m, not) => not ? `(${m}&&!${IS_BYPASSEABLE_INTENTION})` diff --git a/src/plugins/messageTags/index.ts b/src/plugins/messageTags/index.ts index 5a5d03fdb..49e88c42d 100644 --- a/src/plugins/messageTags/index.ts +++ b/src/plugins/messageTags/index.ts @@ -89,7 +89,7 @@ export default definePlugin({ settings, async start() { - // TODO: Remove DataStore tags migration once enough time has passed + // TODO(OptionType.CUSTOM Related): Remove DataStore tags migration once enough time has passed const oldTags = await DataStore.get(DATA_KEY); if (oldTags != null) { // @ts-ignore diff --git a/src/plugins/openInApp/index.ts b/src/plugins/openInApp/index.ts index e344f1458..1c90b5290 100644 --- a/src/plugins/openInApp/index.ts +++ b/src/plugins/openInApp/index.ts @@ -100,6 +100,7 @@ export default definePlugin({ replace: "true" }, { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(!)?\(0,\i\.isDesktop\)\(\)/, replace: (_, not) => not ? "false" : "true" } diff --git a/src/plugins/permissionFreeWill/index.ts b/src/plugins/permissionFreeWill/index.ts index 510d9cb3b..8a6135145 100644 --- a/src/plugins/permissionFreeWill/index.ts +++ b/src/plugins/permissionFreeWill/index.ts @@ -46,6 +46,7 @@ export default definePlugin({ find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}", replacement: [ { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /{(?:\i:(?:function\(\){return |\(\)=>)\i}?,?){2}}/, replace: m => m.replaceAll(canonicalizeMatch(/(function\(\){return |\(\)=>)\i/g), "$1()=>Promise.resolve(true)") } diff --git a/src/plugins/pinDms/data.ts b/src/plugins/pinDms/data.ts index 2f4a1156e..d689bd2af 100644 --- a/src/plugins/pinDms/data.ts +++ b/src/plugins/pinDms/data.ts @@ -155,7 +155,7 @@ export function moveChannel(channelId: string, direction: -1 | 1) { swapElementsInArray(category.channels, a, b); } -// TODO: Remove DataStore PinnedDms migration once enough time has passed +// TODO(OptionType.CUSTOM Related): Remove DataStore PinnedDms migration once enough time has passed async function migrateData() { if (Settings.plugins.PinDMs.dmSectioncollapsed != null) { settings.store.dmSectionCollapsed = Settings.plugins.PinDMs.dmSectioncollapsed; diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 382990d06..09291b825 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -108,6 +108,7 @@ export default definePlugin({ }, { // Prevent Discord from trying to connect to hidden voice channels + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(?=(\|\||&&)\i\.\i\.selectVoiceChannel\((\i)\.id\))/, replace: (_, condition, channel) => condition === "||" ? `||$self.isHiddenChannel(${channel})` @@ -124,6 +125,7 @@ export default definePlugin({ { find: ".AUDIENCE),{isSubscriptionGated", replacement: { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(!)?(\i)\.isRoleSubscriptionTemplatePreviewChannel\(\)/, replace: (m, not, channel) => not ? `${m}&&!$self.isHiddenChannel(${channel})` @@ -177,6 +179,7 @@ export default definePlugin({ }, // Make voice channels also appear as muted if they are muted { + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(?<=\.wrapper:\i\.notInteractive,)(.+?)(if\()?(\i)(?:\)return |\?)(\i\.MUTED)/, replace: (_, otherClasses, isIf, isMuted, mutedClassExpression) => isIf ? `${isMuted}?${mutedClassExpression}:"",${otherClasses}if(${isMuted})return ""` @@ -190,6 +193,7 @@ export default definePlugin({ { // Make muted channels also appear as unread if hide unreads is false, using the HiddenIconWithMutedStyle and the channel is hidden predicate: () => settings.store.hideUnreads === false && settings.store.showMode === ShowMode.HiddenIconWithMutedStyle, + // FIXME(Bundler change related): Remove old compatiblity once enough time has passed match: /(?<=\.LOCKED(?:;if\(|:))(?<={channel:(\i).+?)/, replace: (_, channel) => `!$self.isHiddenChannel(${channel})&&` }, diff --git a/src/plugins/textReplace/index.tsx b/src/plugins/textReplace/index.tsx index 4bec9b6f9..d5d6f4dc8 100644 --- a/src/plugins/textReplace/index.tsx +++ b/src/plugins/textReplace/index.tsx @@ -244,7 +244,7 @@ export default definePlugin({ }, async start() { - // TODO: Remove DataStore rules migrations once enough time has passed + // TODO(OptionType.CUSTOM Related): Remove DataStore rules migrations once enough time has passed const oldStringRules = await DataStore.get(STRING_RULES_KEY); if (oldStringRules != null) { settings.store.stringRules = oldStringRules;