diff --git a/src/Vencord.ts b/src/Vencord.ts index e461520ce..45c9326f1 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -34,6 +34,7 @@ import { debounce } from "@shared/debounce"; import { IS_WINDOWS } from "@utils/constants"; import { createAndAppendStyle } from "@utils/css"; import { StartAt } from "@utils/types"; +import { SettingsRouter } from "@webpack/common"; import { get as dsGet } from "./api/DataStore"; import { popNotice, showNotice } from "./api/Notices"; @@ -45,7 +46,6 @@ import { localStorage } from "./utils/localStorage"; import { relaunch } from "./utils/native"; import { checkForUpdates, isOutdated as getIsOutdated, update, UpdateLogger } from "./utils/updater"; import { onceReady } from "./webpack"; -import { openUserSettingsPanel } from "./webpack/common"; import { patches } from "./webpack/patchWebpack"; if (IS_REPORTER) { @@ -66,7 +66,7 @@ async function syncSettings() { title: "Cloud Settings", body: "Cloud sync was disabled because this account isn't connected to the cloud App. You can enable it again by connecting this account in Cloud Settings. (note: it will store your preferences separately)", color: "var(--yellow-360)", - onClick: () => openUserSettingsPanel("equicord_cloud") + onClick: () => SettingsRouter.openUserSettings("equicord_cloud_panel") }); // Disable cloud sync globally Settings.cloud.authenticated = false; @@ -85,7 +85,7 @@ async function syncSettings() { body: "We've noticed you have cloud integrations enabled in another client! Due to limitations, you will " + "need to re-authenticate to continue using them. Click here to go to the settings page to do so!", color: "var(--yellow-360)", - onClick: () => openUserSettingsPanel("equicord_cloud") + onClick: () => SettingsRouter.openUserSettings("equicord_cloud_panel") }); return; } diff --git a/src/plugins/_api/dynamicImageModalApi.ts b/src/plugins/_api/dynamicImageModalApi.ts index 959f490bf..104b782a5 100644 --- a/src/plugins/_api/dynamicImageModalApi.ts +++ b/src/plugins/_api/dynamicImageModalApi.ts @@ -14,7 +14,7 @@ export default definePlugin({ patches: [ { // TODO: bundler compat - find: /\.renderLinkComponent[)?]\?/, + find: ".renderLinkComponent", replacement: { // widthAndHeightPassed = w != null && w !== 0 && h == null || h === 0 match: /(?<=\i=)(null!=\i&&0!==\i)&&(null!=\i&&0!==\i)/, diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index 484fdd5e7..c76385579 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -100,14 +100,9 @@ export default definePlugin({ { find: "this.renderArtisanalHack()", replacement: [ - { // Fade in on layer - // class Layer { - // static contextType = ...; - // ... - // } - // class OtherClass { - match: /(static contextType=\i\.\i;.+?})(?=class)(?<=class (\i).+?)/, - replace: (_, before, Layer) => `${before};${Layer}=$self.Layer;`, + { + match: /class (\i)(?= extends \i\.PureComponent.+?static contextType=.+?jsx\)\(\1,\{mode:)/, + replace: "var $1=$self.Layer;class VencordPatchedOldFadeLayer", predicate: () => settings.store.disableFade }, { // Lazy-load contents diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index ae327cdae..1e870dae8 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -103,6 +103,10 @@ export default definePlugin({ ].map(find => ({ find, replacement: [ + { + match: /(?<=userValue:)((\i)(?:.{0,10})?\.avatarDecoration)/, + replace: "$self.useUserDecorAvatarDecoration($2)??$1" + }, { match: /(?<=userValue:)((\i)(?:.{0,10})?\.avatarDecoration)/, replace: "$self.useUserDecorAvatarDecoration($2)??$1" diff --git a/src/plugins/normalizeMessageLinks/index.ts b/src/plugins/normalizeMessageLinks/index.ts deleted file mode 100644 index 335cf27fc..000000000 --- a/src/plugins/normalizeMessageLinks/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "NormalizeMessageLinks", - description: "Strip canary/ptb from message links", - authors: [Devs.bb010g], - patches: [ - { - find: "#{intl::COPY_MESSAGE_LINK}", - replacement: { - match: /(?<=(?:.concat\(|\/\/\$\{))location\.host/, - replace: "$self.normalizeHost(location.host)", - }, - }, - ], - normalizeHost(host: string) { - return host.replace(/(^|\b)(canary\.|ptb\.)(discord.com)$/, "$1$3"); - }, -}); diff --git a/src/plugins/platformIndicators/index.tsx b/src/plugins/platformIndicators/index.tsx index b2ed2043e..9c3fc55f4 100644 --- a/src/plugins/platformIndicators/index.tsx +++ b/src/plugins/platformIndicators/index.tsx @@ -40,7 +40,7 @@ export interface Session { const SessionsStore = findStoreLazy("SessionsStore") as { getSessions(): Record; }; -const { useStatusFillColor } = mapMangledModuleLazy("translate(${.5625*", { +const { useStatusFillColor } = mapMangledModuleLazy([".5625*", "translate"], { useStatusFillColor: filters.byCode(".hex") }); diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 43a270a5b..6ef86c425 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -352,6 +352,13 @@ export default definePlugin({ match: /\i>0(?=&&!\i&&!\i)/, replace: m => `($self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)?true:${m})` }, + { + // Show only the plus text without overflowed children amount + // if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen + match: /(?<=`\+\$\{)\i(?=\})/, + replace: overflowTextAmount => "" + + `$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&(${overflowTextAmount}-1)<=0?"":${overflowTextAmount}` + }, { // Show only the plus text without overflowed children amount // if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index 82ff7a77c..9a329474d 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -52,7 +52,7 @@ export default definePlugin({ }, }, { - find: /\.INVITES_DISABLED\)(?:\))?\|\|/, + find: "INVITES_DISABLED)||", predicate: () => settings.store.showInvitesPaused, replacement: { match: /\i\.\i\.can\(\i\.\i.MANAGE_GUILD,\i\)/, diff --git a/src/plugins/typingTweaks/index.tsx b/src/plugins/typingTweaks/index.tsx index b71e93bfd..94de00ea7 100644 --- a/src/plugins/typingTweaks/index.tsx +++ b/src/plugins/typingTweaks/index.tsx @@ -131,7 +131,7 @@ export default definePlugin({ replace: "$self.renderTypingUsers({ users: arguments[0]?.typingUserObjects, guildId: arguments[0]?.channel?.guild_id, children: $& })" }, { - match: /(?<=function \i\(\i\)\{)(?=[^}]+?\{channel:\i,isThreadCreation:\i=!1,...\i\})/, + match: /(?<=function \i\(\i\)\{)(?=[^}]+?\{channel:\i,isThreadCreation:\i=!1,\.\.\.\i\})/, replace: "let typingUserObjects = $self.useTypingUsers(arguments[0]?.channel);" }, { diff --git a/src/plugins/webKeybinds.web/index.ts b/src/plugins/webKeybinds.web/index.ts index 8ee938230..b9b49c35c 100644 --- a/src/plugins/webKeybinds.web/index.ts +++ b/src/plugins/webKeybinds.web/index.ts @@ -19,7 +19,7 @@ import { Devs, IS_MAC } from "@utils/constants"; import definePlugin from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { ComponentDispatch, FluxDispatcher, NavigationRouter, openUserSettingsPanel, SelectedGuildStore } from "@webpack/common"; +import { ComponentDispatch, FluxDispatcher, NavigationRouter, SelectedGuildStore, SettingsRouter } from "@webpack/common"; const KeyBinds = findByPropsLazy("JUMP_TO_GUILD", "SERVER_NEXT"); @@ -55,7 +55,7 @@ export default definePlugin({ break; case ",": e.preventDefault(); - openUserSettingsPanel("my_account"); + SettingsRouter.openUserSettings("my_account_panel"); break; default: if (e.key >= "1" && e.key <= "9") {