diff --git a/src/api/PluginManager.ts b/src/api/PluginManager.ts index 17976da31..3549c4fd9 100644 --- a/src/api/PluginManager.ts +++ b/src/api/PluginManager.ts @@ -183,7 +183,7 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p: const { name, commands, contextMenus, managedStyle, userProfileBadge, onBeforeMessageEdit, onBeforeMessageSend, onMessageClick, - renderChatBarButton, chatBarButton, renderMemberListDecorator, renderMessageAccessory, renderMessageDecoration, renderMessagePopoverButton, messagePopoverButton + chatBarButton, renderMemberListDecorator, renderMessageAccessory, renderMessageDecoration, messagePopoverButton } = p; if (p.start) { @@ -234,14 +234,10 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p: if (onMessageClick) addMessageClickListener(onMessageClick); if (chatBarButton) addChatBarButton(name, chatBarButton.render, chatBarButton.icon); - // @ts-expect-error: legacy code doesn't have icon - else if (renderChatBarButton) addChatBarButton(name, renderChatBarButton); if (renderMemberListDecorator) addMemberListDecorator(name, renderMemberListDecorator); if (renderMessageDecoration) addMessageDecoration(name, renderMessageDecoration); if (renderMessageAccessory) addMessageAccessory(name, renderMessageAccessory); if (messagePopoverButton) addMessagePopoverButton(name, messagePopoverButton.render, messagePopoverButton.icon); - // @ts-expect-error: legacy code doesn't have icon - else if (renderMessagePopoverButton) addMessagePopoverButton(name, renderMessagePopoverButton); return true; }, p => `startPlugin ${p.name}`); @@ -250,7 +246,7 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu const { name, commands, contextMenus, managedStyle, userProfileBadge, onBeforeMessageEdit, onBeforeMessageSend, onMessageClick, - renderChatBarButton, chatBarButton, renderMemberListDecorator, renderMessageAccessory, renderMessageDecoration, renderMessagePopoverButton, messagePopoverButton + chatBarButton, renderMemberListDecorator, renderMessageAccessory, renderMessageDecoration, messagePopoverButton } = p; if (p.stop) { @@ -298,11 +294,11 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu if (onBeforeMessageSend) removeMessagePreSendListener(onBeforeMessageSend); if (onMessageClick) removeMessageClickListener(onMessageClick); - if (chatBarButton || renderChatBarButton) removeChatBarButton(name); + if (chatBarButton) removeChatBarButton(name); if (renderMemberListDecorator) removeMemberListDecorator(name); if (renderMessageDecoration) removeMessageDecoration(name); if (renderMessageAccessory) removeMessageAccessory(name); - if (messagePopoverButton || renderMessagePopoverButton) removeMessagePopoverButton(name); + if (messagePopoverButton) removeMessagePopoverButton(name); return true; }, p => `stopPlugin ${p.name}`); @@ -313,7 +309,7 @@ export const initPluginManager = onlyOnce(function init() { const pluginKeysToBind: Array = [ "onBeforeMessageEdit", "onBeforeMessageSend", "onMessageClick", - "renderChatBarButton", "renderMemberListDecorator", "renderMessageAccessory", "renderMessageDecoration", "renderMessagePopoverButton" + "renderMemberListDecorator", "renderMessageAccessory", "renderMessageDecoration" ]; const neededApiPlugins = new Set(); @@ -343,11 +339,11 @@ export const initPluginManager = onlyOnce(function init() { if (p.commands?.length) neededApiPlugins.add("CommandsAPI"); if (p.onBeforeMessageEdit || p.onBeforeMessageSend || p.onMessageClick) neededApiPlugins.add("MessageEventsAPI"); - if (p.chatBarButton || p.renderChatBarButton) neededApiPlugins.add("ChatInputButtonAPI"); + if (p.chatBarButton) neededApiPlugins.add("ChatInputButtonAPI"); if (p.renderMemberListDecorator) neededApiPlugins.add("MemberListDecoratorsAPI"); if (p.renderMessageAccessory) neededApiPlugins.add("MessageAccessoriesAPI"); if (p.renderMessageDecoration) neededApiPlugins.add("MessageDecorationsAPI"); - if (p.messagePopoverButton || p.renderMessagePopoverButton) neededApiPlugins.add("MessagePopoverAPI"); + if (p.messagePopoverButton) neededApiPlugins.add("MessagePopoverAPI"); if (p.userProfileBadge) neededApiPlugins.add("BadgeAPI"); for (const key of pluginKeysToBind) { diff --git a/src/plugins/_api/commands.ts b/src/plugins/_api/commands.ts index 313daea3d..3a86a3cb9 100644 --- a/src/plugins/_api/commands.ts +++ b/src/plugins/_api/commands.ts @@ -52,12 +52,6 @@ export default definePlugin({ { find: "#{intl::COMMANDS_OPTIONAL_COUNT}", replacement: [ - { - // ...children: p?.name - match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/, - replace: "$1.plugin||($&)", - noWarn: true // TODO: remove legacy compatibility code in the future - }, { match: /children:(?=\i\?\?\i\?\.name)(?<=command:(\i),.+?)/, replace: "children:$1.plugin??" diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 4cbd95c9a..effe3011a 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -14,7 +14,6 @@ export default definePlugin({ description: "Allows you to omit either width or height when opening an image modal", patches: [ { - // TODO: bundler compat find: ".renderLinkComponent", replacement: { // widthAndHeightPassed = w != null && w !== 0 && h == null || h === 0 diff --git a/src/plugins/_api/notices.ts b/src/plugins/_api/notices.ts index a243e86c2..2384a10e4 100644 --- a/src/plugins/_api/notices.ts +++ b/src/plugins/_api/notices.ts @@ -35,12 +35,6 @@ export default definePlugin({ { match: /(?<=,NOTICE_DISMISS:function\(\i\){)return null!=(\i)/, replace: (m, notice) => `if(${notice}?.id=="VencordNotice")return(${notice}=null,Vencord.Api.Notices.nextNotice(),true);${m}` - }, - // FIXME(Bundler agressive inline): Remove the non used compability once enough time has passed - { - match: /(?<=function (\i)\(\i\){)return null!=(\i)(?=.+?NOTICE_DISMISS:\1)/, - replace: (m, _, notice) => `if(${notice}?.id=="VencordNotice")return(${notice}=null,Vencord.Api.Notices.nextNotice(),true);${m}`, - noWarn: true } ] } diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 01a57f789..369094373 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -92,16 +92,6 @@ const settings = definePluginSettings({ } }); -const settingsSectionMap: [string, string][] = [ - ["VencordSettings", "vencord_main_panel"], - ["VencordPlugins", "vencord_plugins_panel"], - ["VencordThemes", "vencord_themes_panel"], - ["VencordUpdater", "vencord_updater_panel"], - ["VencordCloud", "vencord_cloud_panel"], - ["VencordBackupAndRestore", "vencord_backup_restore_panel"], - ["VencordPatchHelper", "vencord_patch_helper_panel"] -]; - export default definePlugin({ name: "Settings", description: "Adds Settings UI and debug info", @@ -109,7 +99,6 @@ export default definePlugin({ required: true, settings, - settingsSectionMap, patches: [ { @@ -122,13 +111,6 @@ export default definePlugin({ return `${m},$self.makeInfoElements(${component},${props}).map(e=>${makeRow}e})),`; } }, - { - match: /"text-xs\/normal".{0,300}?\[\(0,\i\.jsxs?\)\((.{1,10}),(\{[^{}}]+\{.{0,20}className:\i.\i,.+?\})\)," "/, - replace: (m, component, props) => { - props = props.replace(/children:\[.+\]/, ""); - return `${m},$self.makeInfoElements(${component},${props})`; - } - }, { match: /copyValue:\i\.join\(" "\)/g, replace: "$& + $self.getInfoString()" @@ -141,13 +123,6 @@ export default definePlugin({ match: /(\i)\.buildLayout\(\)(?=\.map)/, replace: "$self.buildLayout($1)" } - }, - { - find: "getWebUserSettingFromSection", - replacement: { - match: /new Map\(\[(?=\[.{0,10}\.ACCOUNT,.{0,10}\.ACCOUNT_PANEL)/, - replace: "new Map([...$self.getSettingsSectionMappings()," - } } ], @@ -179,10 +154,6 @@ export default definePlugin({ }); }, - getSettingsSectionMappings() { - return settingsSectionMap; - }, - buildLayout(originalLayoutBuilder: SettingsLayoutBuilder) { const layout = originalLayoutBuilder.buildLayout(); if (originalLayoutBuilder.key !== "$Root") return layout; diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 102c5bb2e..8085a0ca3 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -101,8 +101,7 @@ export default definePlugin({ find: "Clear Treatment ", replacement: [ { - // TODO: stable compat optional chaining remove once some time has passed - match: /\i\??\.isStaff\(\)/, + match: /\i\?\.isStaff\(\)/, replace: "true" }, // Fix some tricky experiments name causing a client crash diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index eb03942f5..6f170c41a 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -137,8 +137,7 @@ export default definePlugin({ { find: "MessageReactions.render:", replacement: { - // FIXME: (?:medium|normal) is for stable compat - match: /tag:"strong",variant:"text-md\/(?:medium|normal)"(?<=onContextMenu:.{0,15}\((\i),(\i),\i\).+?)/, + match: /tag:"strong",variant:"text-md\/medium"(?<=onContextMenu:.{0,15}\((\i),(\i),\i\).+?)/, replace: "$&,style:$self.getColorStyle($2?.id,$1?.channel?.id)" }, predicate: () => settings.store.reactorsList, diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index 2a8eac3c0..4a8c06807 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -19,6 +19,7 @@ import { ClockIcon } from "@components/Icons"; import SettingsPlugin from "@plugins/_core/settings"; import { Devs } from "@utils/constants"; +import { removeFromArray } from "@utils/misc"; import definePlugin from "@utils/types"; import StartupTimingPage from "./StartupTimingPage"; @@ -34,14 +35,8 @@ export default definePlugin({ Component: StartupTimingPage, Icon: ClockIcon }); - SettingsPlugin.settingsSectionMap.push(["VencordStartupTimings", "vencord_startup_timings"]); }, stop() { - function removeFromArray(arr: T[], predicate: (e: T) => boolean) { - const idx = arr.findIndex(predicate); - if (idx !== -1) arr.splice(idx, 1); - } removeFromArray(SettingsPlugin.customEntries, e => e.key === "vencord_startup_timings"); - removeFromArray(SettingsPlugin.settingsSectionMap, entry => entry[1] === "vencord_startup_timings"); }, }); diff --git a/src/plugins/superReactionTweaks/index.ts b/src/plugins/superReactionTweaks/index.ts index 125825a88..abe7bb135 100644 --- a/src/plugins/superReactionTweaks/index.ts +++ b/src/plugins/superReactionTweaks/index.ts @@ -46,17 +46,6 @@ export default definePlugin({ // if (inlinedCalculatePlayingCount(a,b) >= limit) return; match: /(BURST_REACTION_EFFECT_PLAY:\i=>{.+?if\()(\(\(\i,\i\)=>.+?\(\i,\i\))>=5+?(?=\))/, replace: (_, rest, playingCount) => `${rest}!$self.shouldPlayBurstReaction(${playingCount})` - }, - // FIXME(Bundler agressive inline): Remove the non used compability once enough time has passed - { - /* - * var limit = 5 - * ... - * if (calculatePlayingCount(a,b) >= limit) return; - */ - match: /((\i)=5.+?)if\((.{0,20}?)>=\2\)return;/, - replace: (_, rest, playingCount) => `${rest}if(!$self.shouldPlayBurstReaction(${playingCount}))return;`, - noWarn: true } ] }, diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 5091f604c..2ca072040 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -46,11 +46,6 @@ export default definePlugin({ { find: "ReferencedMessageStore", replacement: [ - { - match: /constructor\(\)\{\i\(this,"_channelCaches",new Map\)/, - replace: "$&;$self.setReplyStore(this);", - noWarn: true // TODO: remove legacy compatibility code in the future - }, { match: /_channelCaches=new Map;/, replace: "$&_=$self.setReplyStore(this);" diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 8b13960da..9ea78cc6d 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -97,3 +97,8 @@ export function tryOrElse(func: () => T, fallback: T): T { return fallback; } } + +export function removeFromArray(arr: T[], predicate: (e: T) => boolean) { + const idx = arr.findIndex(predicate); + if (idx !== -1) arr.splice(idx, 1); +} diff --git a/src/utils/types.ts b/src/utils/types.ts index 8177066bd..b7c5e9781 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -197,16 +197,6 @@ export interface PluginDef { renderMessageDecoration?: MessageDecorationFactory; renderMemberListDecorator?: MemberListDecoratorFactory; - - // TODO: Remove eventually - /** - * @deprecated Use {@link chatBarButton} instead - */ - renderChatBarButton?: never; - /** - * @deprecated Use {@link messagePopoverButton} instead - */ - renderMessagePopoverButton?: never; } export const enum StartAt {