From 109a1508b64e9bb1c1c9e4b26c5f73f01a2a3f09 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 03:15:59 -0500 Subject: [PATCH 01/28] Canary Fixes --- src/equicordplugins/anammox/index.ts | 4 ++-- src/equicordplugins/bannersEverywhere/index.tsx | 2 +- src/equicordplugins/betterBanReasons/index.tsx | 4 ++-- src/equicordplugins/betterInvites/index.tsx | 4 ++-- src/equicordplugins/betterQuickReact/index.tsx | 2 +- src/equicordplugins/betterUserArea/index.tsx | 2 +- src/equicordplugins/clientSideBlock/index.tsx | 2 +- src/equicordplugins/customTimestamps/index.tsx | 2 +- src/equicordplugins/deadMembers/index.tsx | 2 +- src/equicordplugins/frequentQuickSwitcher/index.tsx | 2 +- src/equicordplugins/friendTags/index.tsx | 2 +- src/equicordplugins/fullUserInChatbox/index.tsx | 2 +- src/equicordplugins/hideServers/index.tsx | 4 ++-- src/equicordplugins/homeTyping/index.tsx | 2 +- src/equicordplugins/identity/index.tsx | 2 +- src/equicordplugins/ignoreTerms/index.ts | 2 +- src/equicordplugins/keywordNotify/index.tsx | 6 +++--- src/equicordplugins/loginWithQR/index.tsx | 6 +++--- src/equicordplugins/messageLinkTooltip/index.tsx | 4 ++-- src/equicordplugins/moreStickers/index.tsx | 6 +++--- src/equicordplugins/noAppsAllowed/index.tsx | 6 +++--- src/equicordplugins/pinIcon/index.tsx | 4 ++-- src/equicordplugins/showBadgesInChat/index.tsx | 2 +- src/equicordplugins/sidebarChat/index.tsx | 2 +- src/equicordplugins/statusPresets/index.tsx | 6 +++--- src/equicordplugins/whitelistedEmojis/index.tsx | 2 +- src/equicordplugins/youtubeDescription/index.tsx | 2 +- 27 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/equicordplugins/anammox/index.ts b/src/equicordplugins/anammox/index.ts index e0861b60c..64b55a52c 100644 --- a/src/equicordplugins/anammox/index.ts +++ b/src/equicordplugins/anammox/index.ts @@ -99,7 +99,7 @@ export default definePlugin({ }, { // Emoji list - find: "Messages.EMOJI_PICKER_CREATE_EMOJI_TITLE,size:", + find: "isEmojiCategoryNitroLocked({", replacement: { match: /(\i)=\i\|\|!\i&&\i.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/, replace: "$&$1||" @@ -108,7 +108,7 @@ export default definePlugin({ }, { // Emoji category list - find: "Messages.EMOJI_CATEGORY_TOP_GUILD_EMOJI.format({", + find: "EMOJI_PICKER_REACTION_EMOJI_CLICKED;", replacement: { match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/, replace: "$2.isNitroLocked||" diff --git a/src/equicordplugins/bannersEverywhere/index.tsx b/src/equicordplugins/bannersEverywhere/index.tsx index d3e6b1642..128a43562 100644 --- a/src/equicordplugins/bannersEverywhere/index.tsx +++ b/src/equicordplugins/bannersEverywhere/index.tsx @@ -39,7 +39,7 @@ export default definePlugin({ settings, patches: [ { - find: ".Messages.GUILD_OWNER,", + find: "MEMBER_LIST,tagUserId", replacement: { // We add the banner as a property while we can still access the user id diff --git a/src/equicordplugins/betterBanReasons/index.tsx b/src/equicordplugins/betterBanReasons/index.tsx index 853cd1b0f..407e7efc3 100644 --- a/src/equicordplugins/betterBanReasons/index.tsx +++ b/src/equicordplugins/betterBanReasons/index.tsx @@ -72,9 +72,9 @@ export default definePlugin({ authors: [Devs.Inbestigator], patches: [ { - find: "Messages.BAN_MULTIPLE_CONFIRM_TITLE", + find: "banReasonOtherClickable,children", replacement: [{ - match: /\[\{name:\i\.\i\.Messages\.BAN_REASON_OPTION_SPAM_ACCOUNT.+?\}\]/, + match: /\[\{name:\i\.\i.+?\}\]/, replace: "$self.getReasons()" }, { diff --git a/src/equicordplugins/betterInvites/index.tsx b/src/equicordplugins/betterInvites/index.tsx index e157d0776..10859f195 100644 --- a/src/equicordplugins/betterInvites/index.tsx +++ b/src/equicordplugins/betterInvites/index.tsx @@ -37,10 +37,10 @@ export default definePlugin({ authors: [EquicordDevs.iamme], patches: [ { - find: ".Messages.HUB_INVITE_ANOTHER_SCHOOL_LINK", + find: ".GuildSplash,{guild", replacement: [ { - match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(\i\.\i\.Messages.GUEST_MEMBERSHIP_EXPLANATION)/, + match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.{0,50}text:)(\i.{0,50}]\))/, replace: ",($1||((!$1)&&arguments[0].invite.expires_at)) && $2$self.RenderTip($1, $3, arguments[0].invite.expires_at)" }, { diff --git a/src/equicordplugins/betterQuickReact/index.tsx b/src/equicordplugins/betterQuickReact/index.tsx index c3186ec45..6a47d9b07 100644 --- a/src/equicordplugins/betterQuickReact/index.tsx +++ b/src/equicordplugins/betterQuickReact/index.tsx @@ -59,7 +59,7 @@ export default definePlugin({ } }, { - find: ".ADD_REACTION_NAMED.format", + find: "allNamesString,hideOnClick", group: true, replacement: [ // Override limit of emojis to display with offset hook. diff --git a/src/equicordplugins/betterUserArea/index.tsx b/src/equicordplugins/betterUserArea/index.tsx index 5724e5ec2..bf77374a0 100644 --- a/src/equicordplugins/betterUserArea/index.tsx +++ b/src/equicordplugins/betterUserArea/index.tsx @@ -15,7 +15,7 @@ export default definePlugin({ description: "Reworks the user area styling to fit more buttons and overall look nicer", authors: [Devs.Samwich], patches: [{ - find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED", + find: "handleToggleSelfMute,onContextMenu", replacement: [ // add a custom class to make things easier diff --git a/src/equicordplugins/clientSideBlock/index.tsx b/src/equicordplugins/clientSideBlock/index.tsx index ee0ee7411..b16b6aeb0 100644 --- a/src/equicordplugins/clientSideBlock/index.tsx +++ b/src/equicordplugins/clientSideBlock/index.tsx @@ -167,7 +167,7 @@ export default definePlugin({ }, // "1 blocked message" { - find: "Messages.BLOCKED_MESSAGES_HIDE.format", + find: "blockedAction,children", replacement: { match: /\i.memo\(function\(\i\){/, replace: "$&return null;" diff --git a/src/equicordplugins/customTimestamps/index.tsx b/src/equicordplugins/customTimestamps/index.tsx index 590249306..e6c3e37f7 100644 --- a/src/equicordplugins/customTimestamps/index.tsx +++ b/src/equicordplugins/customTimestamps/index.tsx @@ -67,7 +67,7 @@ export default definePlugin({ ), patches: [{ - find: "MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format", + find: "timestampTooltip,delay", replacement: [ { match: /(?<=\i=\i\?)\(0,\i\.\i\)\((\i),"LT"\):\(0,\i\.\i\)\(\i\)/, diff --git a/src/equicordplugins/deadMembers/index.tsx b/src/equicordplugins/deadMembers/index.tsx index 7e253de4a..b92c00544 100644 --- a/src/equicordplugins/deadMembers/index.tsx +++ b/src/equicordplugins/deadMembers/index.tsx @@ -22,7 +22,7 @@ export default definePlugin({ } }, { - find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL", + find: "stopPropagation:!0,ariaLabel", replacement: { match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/, replace: "$self.wrapForumAuthor({...$1,$2},$&)" diff --git a/src/equicordplugins/frequentQuickSwitcher/index.tsx b/src/equicordplugins/frequentQuickSwitcher/index.tsx index 52994d9c5..a9aa09c6a 100644 --- a/src/equicordplugins/frequentQuickSwitcher/index.tsx +++ b/src/equicordplugins/frequentQuickSwitcher/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ generateSearchResults: generateSearchResults, patches: [ { - find: ".QUICKSWITCHER_PLACEHOLDER", + find: "uery,spellCheck:!1,autoFocus", replacement: { match: /let{selectedIndex:\i,results:\i}/, replace: "this.props.results = $self.generateSearchResults(this.state.query);$&" diff --git a/src/equicordplugins/friendTags/index.tsx b/src/equicordplugins/friendTags/index.tsx index e6c2b9d97..00311196b 100644 --- a/src/equicordplugins/friendTags/index.tsx +++ b/src/equicordplugins/friendTags/index.tsx @@ -212,7 +212,7 @@ export default definePlugin({ queryFriendTags: queryFriendTags, patches: [ { - find: ".QUICKSWITCHER_PLACEHOLDER", + find: "query,spellCheck:!1,autoFocus", replacement: { match: /let{selectedIndex:\i,results:\i}/, replace: "if(this.state.query.includes(\"&\")){ this.props.results = $self.queryFriendTags(this.state.query); }$&" diff --git a/src/equicordplugins/fullUserInChatbox/index.tsx b/src/equicordplugins/fullUserInChatbox/index.tsx index 51e606766..10afc47f0 100644 --- a/src/equicordplugins/fullUserInChatbox/index.tsx +++ b/src/equicordplugins/fullUserInChatbox/index.tsx @@ -17,7 +17,7 @@ export default definePlugin({ patches: [ { - find: "UNKNOWN_ROLE_PLACEHOLDER]", + find: "colorString,background", replacement: { match: /(hidePersonalInformation.*?)return/, replace: "$1return $self.patchChatboxMention(arguments[0]);" diff --git a/src/equicordplugins/hideServers/index.tsx b/src/equicordplugins/hideServers/index.tsx index a7dfbd4ab..bff5ea404 100644 --- a/src/equicordplugins/hideServers/index.tsx +++ b/src/equicordplugins/hideServers/index.tsx @@ -77,7 +77,7 @@ export default definePlugin({ find: '("guildsnav")', replacement: [ { - match: /(?<=Messages\.SERVERS,children:.{0,300}?)(\i)(\)?\.map\(\i\))/, + match: /(?<=onActivate.{0,100},children:.{0,300}?)(\i)(\)?\.map\(\i\))/, replace: "$self.useFilteredGuilds($1)$2", }, // despite my best efforts, the above doesnt trigger a rerender @@ -88,7 +88,7 @@ export default definePlugin({ ] }, { - find: "QUICKSWITCHER_PROTIP.format", + find: '"quick-switcher-".concat', replacement: { match: /(?<=renderResults\(\){)let{query/, replace: "this.props.results = $self.filteredGuildResults(this.props.results);$&", diff --git a/src/equicordplugins/homeTyping/index.tsx b/src/equicordplugins/homeTyping/index.tsx index f54ef98fe..ef6ec3277 100644 --- a/src/equicordplugins/homeTyping/index.tsx +++ b/src/equicordplugins/homeTyping/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ }, patches: [ { - find: ".Messages.DISCODO_DISABLED", + find: "downloadProgress,determineOwnVisibility", replacement: [ { diff --git a/src/equicordplugins/identity/index.tsx b/src/equicordplugins/identity/index.tsx index 58462594f..fc273aa4c 100644 --- a/src/equicordplugins/identity/index.tsx +++ b/src/equicordplugins/identity/index.tsx @@ -140,7 +140,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/, + match: /(?<=sectionTitle:.{0,50}]\)},"decoration"\),)/, replace: "$self.ResetCard()," } }, diff --git a/src/equicordplugins/ignoreTerms/index.ts b/src/equicordplugins/ignoreTerms/index.ts index dc25dcf35..809850847 100644 --- a/src/equicordplugins/ignoreTerms/index.ts +++ b/src/equicordplugins/ignoreTerms/index.ts @@ -13,7 +13,7 @@ export default definePlugin({ authors: [Devs.D3SOX], patches: [ { - find: "Messages.NEW_TERMS_TITLE", + find: "USER_AGREEMENTS,properties", replacement: { match: /function (\i)\((\i)\)\{let\{transitionState:(\i)\}=(\i)/g, replace: "function $1($2){return $self.closeModal($2);let{transitionState:$3}=$4" diff --git a/src/equicordplugins/keywordNotify/index.tsx b/src/equicordplugins/keywordNotify/index.tsx index bf4cc2a3a..54d021480 100644 --- a/src/equicordplugins/keywordNotify/index.tsx +++ b/src/equicordplugins/keywordNotify/index.tsx @@ -33,7 +33,7 @@ const recentMentionsPopoutClass = findByPropsLazy("recentMentionsPopout"); const tabClass = findByPropsLazy("inboxTitle", "tab"); const buttonClass = findByPropsLazy("size36"); const MenuHeader = findByCodeLazy(".getUnseenInviteCount())"); -const Popout = findByCodeLazy(".Messages.UNBLOCK_TO_JUMP_TITLE", "canCloseAllMessages:"); +const Popout = findByCodeLazy(".trackJump", "canCloseAllMessages:"); const createMessageRecord = findByCodeLazy(".createFromServer(", ".isBlockedForMessage", "messageReference:"); const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries"; const KEYWORD_LOG_KEY = "KeywordNotify_log"; @@ -313,14 +313,14 @@ export default definePlugin({ settings, patches: [ { - find: "Messages.UNREADS_TAB_LABEL}", + find: "TODOS,className", replacement: { match: /\i\?\(0,\i\.jsxs\)\(\i\.TabBar\.Item/, replace: "$self.keywordTabBar(),$&" } }, { - find: "location:\"RecentsPopout\"})", + find: "location:\"RecentsPopout\"});", replacement: { match: /:(\i)===\i\.\i\.MENTIONS\?\(0,.+?setTab:(\i),onJump:(\i),badgeState:\i,closePopout:(\i)/, replace: ": $1 === 8 ? $self.tryKeywordMenu($2, $3, $4) $&" diff --git a/src/equicordplugins/loginWithQR/index.tsx b/src/equicordplugins/loginWithQR/index.tsx index dbadb292f..b1d3d3062 100644 --- a/src/equicordplugins/loginWithQR/index.tsx +++ b/src/equicordplugins/loginWithQR/index.tsx @@ -58,13 +58,13 @@ export default definePlugin({ replacement: { // Find the Edit User Profile button and insert our custom button. // A bit jank, but whatever - match: /,(.{11}\.Button,.{58}\.USER_SETTINGS_EDIT_USER_PROFILE}\))/, - replace: ",$self.insertScanQrButton($1)", + match: /,(.{0,10}\.Button.{0,50},children:.{0,50}}\))]/, + replace: ",$self.insertScanQrButton($1)]", }, }, // Insert a Scan QR Code MenuItem in the Swith Accounts popout { - find: ".SWITCH_ACCOUNTS_MANAGE_ACCOUNTS,", + find: 'id:"manage-accounts"', replacement: { match: /(id:"manage-accounts",.*?)}\)\)(,\i)/, replace: "$1}),$self.ScanQrMenuItem)$2" diff --git a/src/equicordplugins/messageLinkTooltip/index.tsx b/src/equicordplugins/messageLinkTooltip/index.tsx index debd6d263..b5f152cb6 100644 --- a/src/equicordplugins/messageLinkTooltip/index.tsx +++ b/src/equicordplugins/messageLinkTooltip/index.tsx @@ -101,7 +101,7 @@ export default definePlugin({ predicate: () => settings.store.onLink, }, { - find: "Messages.REPLY_QUOTE_MESSAGE_NOT_LOADED", + find: ".NOT_LOADED:", replacement: { // Should match two places match: /(\i\.Clickable),\{/g, @@ -110,7 +110,7 @@ export default definePlugin({ predicate: () => settings.store.onReply, }, { - find: "Messages.MESSAGE_FORWARDED}", + find: "TEXT_LOW_CONTRAST})]", replacement: { match: /(\i\.Clickable),\{/, replace: "$self.ForwardTooltip,{Component:$1,vcProps:arguments[0]," diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index bcd56fbe1..0d7094c04 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -64,11 +64,11 @@ export default definePlugin({ } }, { - find: ".Messages.EXPRESSION_PICKER_GIF", + find: "GIF,children", replacement: { - match: /role:"tablist",.+?\.Messages\.EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL,children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, + match: /role:"tablist","aria-label":.{0,50},children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, replace: m => { - const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,10}Messages.EXPRESSION_PICKER_STICKER).*?:null/s; + const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,50}]\)).*?:null/s; const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => { const isActive = `${currentTab}==="stickers+"`; return ( diff --git a/src/equicordplugins/noAppsAllowed/index.tsx b/src/equicordplugins/noAppsAllowed/index.tsx index a31bf239b..a435e6374 100644 --- a/src/equicordplugins/noAppsAllowed/index.tsx +++ b/src/equicordplugins/noAppsAllowed/index.tsx @@ -14,10 +14,10 @@ export default definePlugin({ patches: [ { - find: ",APP_TAG:\"", + find: "BOT:default:", replacement: { - match: /APP_TAG:".*?"/, - replace: "APP_TAG:\"BOT\"" + match: /(default:\i)=.{0,30}\)/, + replace: "$1=\"BOT\"" } } ], diff --git a/src/equicordplugins/pinIcon/index.tsx b/src/equicordplugins/pinIcon/index.tsx index d9e58067a..1bc5a04a8 100644 --- a/src/equicordplugins/pinIcon/index.tsx +++ b/src/equicordplugins/pinIcon/index.tsx @@ -27,9 +27,9 @@ export default definePlugin({ authors: [EquicordDevs.iamme], patches: [ { - find: "Messages.MESSAGE_EDITED,", + find: "editedTimestamp,isEdited", replacement: { - match: /Messages\.MESSAGE_EDITED,(?:[^}]*[}]){3}\)/, + match: /editedTimestamp,isEdited(?:[^}]*[}]){3}\)/, replace: "$&,$self.PinnedIcon(arguments[0].message)" } } diff --git a/src/equicordplugins/showBadgesInChat/index.tsx b/src/equicordplugins/showBadgesInChat/index.tsx index dbc0c1165..beaac0de2 100644 --- a/src/equicordplugins/showBadgesInChat/index.tsx +++ b/src/equicordplugins/showBadgesInChat/index.tsx @@ -11,7 +11,7 @@ import definePlugin from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import badges from "plugins/_api/badges"; const roleIconClassName = findByPropsLazy("roleIcon", "separator").roleIcon; -const RoleIconComponent = findComponentByCodeLazy(".Messages.ROLE_ICON_ALT_TEXT"); +const RoleIconComponent = findComponentByCodeLazy(".roleIcon", ".clickable"); import "./styles.css"; import { User } from "discord-types/general"; diff --git a/src/equicordplugins/sidebarChat/index.tsx b/src/equicordplugins/sidebarChat/index.tsx index daf9cc73f..4302cefd2 100644 --- a/src/equicordplugins/sidebarChat/index.tsx +++ b/src/equicordplugins/sidebarChat/index.tsx @@ -34,7 +34,7 @@ const { HeaderBar, HeaderBarIcon } = mapMangledModuleLazy(".themedMobile]:", { }); const Chat = findComponentByCodeLazy("filterAfterTimestamp:", "chatInputType"); const Resize = findComponentByCodeLazy("sidebarType:", "homeSidebarWidth"); -const ChannelHeader = findComponentByCodeLazy(".Messages.HUB_DIRECTORY_CHANNEL_TITLE.format({"); +const ChannelHeader = findComponentByCodeLazy(".GUILD_DIRECTORY", ".HUB"); const ChatInputTypes = findByPropsLazy("FORM", "NORMAL"); const Sidebars = findByPropsLazy("ThreadSidebar", "MessageRequestSidebar"); diff --git a/src/equicordplugins/statusPresets/index.tsx b/src/equicordplugins/statusPresets/index.tsx index 6761caa34..7506ca167 100644 --- a/src/equicordplugins/statusPresets/index.tsx +++ b/src/equicordplugins/statusPresets/index.tsx @@ -131,14 +131,14 @@ export default definePlugin({ dependencies: ["UserSettingsAPI"], patches: [ { - find: "Messages.CUSTOM_STATUS_SET_CUSTOM_STATUS}", + find: "analyticsLocation,children", replacement: { - match: /\.ModalFooter,.{0,70}\.Messages\.SAVE\}\)/, + match: /\.ModalFooter,.{0,70}\.handleSubmit.{0,50}\}\)/, replace: "$&,$self.renderRememberButton(this.state)" } }, { - find: /"aria-label":.{0,3}\.Messages.STATUS_MENU_LABEL/, + find: /statusPickerModalMenu,"aria-label":.{0,1}\..{0,50}\)/, replacement: { match: /!\i&&(.{0,15}\i\.Fragment.{0,55}null==(\i).{0,200}customEmojiPlaceholder\}\),onClick:([^}]+}))/, replace: "$self.render($2, $3),false&&$1" diff --git a/src/equicordplugins/whitelistedEmojis/index.tsx b/src/equicordplugins/whitelistedEmojis/index.tsx index 5354642ad..75d489da7 100644 --- a/src/equicordplugins/whitelistedEmojis/index.tsx +++ b/src/equicordplugins/whitelistedEmojis/index.tsx @@ -601,7 +601,7 @@ export default definePlugin({ authors: [EquicordDevs.creations], patches: [ { - find: ".Messages.EMOJI_MATCHING", + find: "null,titleWithoutQuery", replacement: { match: /renderResults\((\i)\){/, replace: "$&$1.results.emojis=$self.filterEmojis($1);if($1.results.emojis.length===0)return;" diff --git a/src/equicordplugins/youtubeDescription/index.tsx b/src/equicordplugins/youtubeDescription/index.tsx index 1d93d0707..59f5b8233 100644 --- a/src/equicordplugins/youtubeDescription/index.tsx +++ b/src/equicordplugins/youtubeDescription/index.tsx @@ -18,7 +18,7 @@ export default definePlugin({ authors: [Devs.arHSM], patches: [ { - find: ".Messages.SUPPRESS_ALL_EMBEDS", + find: "embedSuppressButton,onClick", replacement: { match: /case (\i\.\i\.VIDEO):(case \i\.\i\.\i:)*break;default:(\i)=(?:(this\.renderDescription)\(\))\}/, replace: "$2 break; case $1: $3 = $self.ToggleableDescriptionWrapper({ embed: this.props.embed, original: $4.bind(this) }); break; default: $3 = $4() }" From c2287a1d5936718346dd14ff3019c962db8a18a5 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 03:23:30 -0500 Subject: [PATCH 02/28] Fix Typo --- src/equicordplugins/frequentQuickSwitcher/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equicordplugins/frequentQuickSwitcher/index.tsx b/src/equicordplugins/frequentQuickSwitcher/index.tsx index a9aa09c6a..d2a4d87ad 100644 --- a/src/equicordplugins/frequentQuickSwitcher/index.tsx +++ b/src/equicordplugins/frequentQuickSwitcher/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ generateSearchResults: generateSearchResults, patches: [ { - find: "uery,spellCheck:!1,autoFocus", + find: "query,spellCheck:!1,autoFocus", replacement: { match: /let{selectedIndex:\i,results:\i}/, replace: "this.props.results = $self.generateSearchResults(this.state.query);$&" From a3952b35a4fb9d43eb9f23e721489db48678650c Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 11:11:31 -0300 Subject: [PATCH 03/28] wip --- package.json | 1 + pnpm-lock.yaml | 132 ++++++++++-------- src/plugins/_api/memberListDecorators.ts | 2 +- src/plugins/_api/messageAccessories.ts | 2 +- src/plugins/_api/messageDecorations.ts | 2 +- src/plugins/_api/messageEvents.ts | 2 +- src/plugins/_api/messagePopover.ts | 4 +- src/plugins/_api/serverList.ts | 6 +- src/plugins/_core/settings.tsx | 4 +- src/plugins/_core/supportHelper.tsx | 2 +- .../accountPanelServerProfile/index.tsx | 2 +- src/plugins/betterFolders/index.tsx | 4 +- src/plugins/decor/index.tsx | 2 +- src/plugins/friendsSince/index.tsx | 4 +- src/plugins/memberCount/index.tsx | 2 +- src/plugins/noUnblockToJump/index.ts | 6 +- src/plugins/volumeBooster/index.ts | 2 +- src/plugins/webContextMenus.web/index.ts | 12 +- src/utils/intlHash.ts | 53 +++++++ src/utils/patches.ts | 18 ++- 20 files changed, 168 insertions(+), 94 deletions(-) create mode 100644 src/utils/intlHash.ts diff --git a/package.json b/package.json index 9d5ad3e58..63ff0678b 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "testTsc": "tsc --noEmit" }, "dependencies": { + "@intrnl/xxhash64": "^0.1.2", "@sapphi-red/web-noise-suppressor": "0.3.5", "@vap/core": "0.0.12", "@vap/shiki": "0.10.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eaa6b537c..eeec05365 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,13 +9,16 @@ patchedDependencies: hash: japuwsqfkulviwgkm4kd2oi3ky path: patches/eslint-plugin-path-alias@2.1.0.patch eslint@9.8.0: - hash: xm46kqcmdgzlmm4aifkfpxaho4 + hash: pxhhii6sqtzo2kyx3geekthd3a path: patches/eslint@9.8.0.patch importers: .: dependencies: + '@intrnl/xxhash64': + specifier: ^0.1.2 + version: 0.1.2 '@sapphi-red/web-noise-suppressor': specifier: 0.3.5 version: 0.3.5 @@ -43,7 +46,7 @@ importers: devDependencies: '@stylistic/eslint-plugin': specifier: ^2.6.1 - version: 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + version: 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) '@types/chrome': specifier: ^0.0.269 version: 0.0.269 @@ -76,22 +79,22 @@ importers: version: 0.15.18 eslint: specifier: ^9.8.0 - version: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + version: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-import-resolver-alias: specifier: ^1.1.2 - version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))) + version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))) eslint-plugin-path-alias: specifier: 2.1.0 - version: 2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + version: 2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) eslint-plugin-simple-header: specifier: ^1.1.1 version: 1.1.1 eslint-plugin-simple-import-sort: specifier: ^12.1.1 - version: 12.1.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + version: 12.1.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) eslint-plugin-unused-imports: specifier: ^4.0.1 - version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) highlight.js: specifier: 10.7.3 version: 10.7.3 @@ -130,7 +133,7 @@ importers: version: 5.5.4 typescript-eslint: specifier: ^8.0.0 - version: 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + version: 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) typescript-transform-paths: specifier: ^3.4.7 version: 3.4.7(typescript@5.5.4) @@ -537,6 +540,9 @@ packages: resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} engines: {node: '>=18.18'} + '@intrnl/xxhash64@0.1.2': + resolution: {integrity: sha512-1+lx7j99fdph+uy3EnjQyr39KQZ7LP56+aWOr6finJWpgYpvb7XrhFUqDwnEk/wpPC98nCjAT6RulpW3crWjlg==} + '@jridgewell/gen-mapping@0.3.5': resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} @@ -2902,9 +2908,9 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': + '@eslint-community/eslint-utils@4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': dependencies: - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-visitor-keys: 3.4.2 '@eslint-community/regexpp@4.11.0': {} @@ -2939,6 +2945,8 @@ snapshots: '@humanwhocodes/retry@0.3.0': {} + '@intrnl/xxhash64@0.1.2': {} + '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 @@ -2988,49 +2996,49 @@ snapshots: '@sapphi-red/web-noise-suppressor@0.3.5': {} - '@stylistic/eslint-plugin-js@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': + '@stylistic/eslint-plugin-js@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': dependencies: '@types/eslint': 9.6.0 acorn: 8.12.1 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-visitor-keys: 4.0.0 espree: 10.1.0 - '@stylistic/eslint-plugin-jsx@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': + '@stylistic/eslint-plugin-jsx@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) '@types/eslint': 9.6.0 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) estraverse: 5.3.0 picomatch: 4.0.2 - '@stylistic/eslint-plugin-plus@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@stylistic/eslint-plugin-plus@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: '@types/eslint': 9.6.0 - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin-ts@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@stylistic/eslint-plugin-ts@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) '@types/eslint': 9.6.0 - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@stylistic/eslint-plugin@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) - '@stylistic/eslint-plugin-jsx': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) - '@stylistic/eslint-plugin-plus': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - '@stylistic/eslint-plugin-ts': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@stylistic/eslint-plugin-jsx': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@stylistic/eslint-plugin-plus': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@stylistic/eslint-plugin-ts': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) '@types/eslint': 9.6.0 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) transitivePeerDependencies: - supports-color - typescript @@ -3125,15 +3133,15 @@ snapshots: dependencies: '@types/node': 22.0.3 - '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) '@typescript-eslint/scope-manager': 8.0.0 - '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.0 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 @@ -3143,14 +3151,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: '@typescript-eslint/scope-manager': 8.0.0 '@typescript-eslint/types': 8.0.0 '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.6 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -3161,10 +3169,10 @@ snapshots: '@typescript-eslint/types': 8.0.0 '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -3190,13 +3198,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': + '@typescript-eslint/utils@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) '@typescript-eslint/scope-manager': 8.0.0 '@typescript-eslint/types': 8.0.0 '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) transitivePeerDependencies: - supports-color - typescript @@ -3848,9 +3856,9 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))): + eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))): dependencies: - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) eslint-import-resolver-node@0.3.9: dependencies: @@ -3860,17 +3868,17 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): + eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -3878,9 +3886,9 @@ snapshots: array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) hasown: 2.0.2 is-core-module: 2.15.0 is-glob: 4.0.3 @@ -3891,15 +3899,15 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-path-alias@2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): + eslint-plugin-path-alias@2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): dependencies: - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) find-pkg: 2.0.0 get-tsconfig: 4.7.5 nanomatch: 1.2.13 @@ -3908,16 +3916,16 @@ snapshots: eslint-plugin-simple-header@1.1.1: {} - eslint-plugin-simple-import-sort@12.1.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): + eslint-plugin-simple-import-sort@12.1.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): dependencies: - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) - eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): + eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): dependencies: - eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) + eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) eslint-rule-composer: 0.3.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) eslint-rule-composer@0.3.0: {} @@ -3932,9 +3940,9 @@ snapshots: eslint-visitor-keys@4.0.0: {} - eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4): + eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) '@eslint-community/regexpp': 4.11.0 '@eslint/config-array': 0.17.1 '@eslint/eslintrc': 3.1.0 @@ -5232,11 +5240,11 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typescript-eslint@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4): + typescript-eslint@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: diff --git a/src/plugins/_api/memberListDecorators.ts b/src/plugins/_api/memberListDecorators.ts index 5e3e5ed18..8e5fe50a1 100644 --- a/src/plugins/_api/memberListDecorators.ts +++ b/src/plugins/_api/memberListDecorators.ts @@ -31,7 +31,7 @@ export default definePlugin({ match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/, replace: "$&vencordProps=$1," }, { - match: /\.Messages\.GUILD_OWNER(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/, + match: /#intl(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/, replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps))," } ] diff --git a/src/plugins/_api/messageAccessories.ts b/src/plugins/_api/messageAccessories.ts index a98fdb32b..dbf363387 100644 --- a/src/plugins/_api/messageAccessories.ts +++ b/src/plugins/_api/messageAccessories.ts @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.Cyn], patches: [ { - find: ".Messages.REMOVE_ATTACHMENT_BODY", + find: "#intl", replacement: { match: /(?<=.container\)?,children:)(\[.+?\])/, replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)", diff --git a/src/plugins/_api/messageDecorations.ts b/src/plugins/_api/messageDecorations.ts index b41ec0be9..a5fb50c62 100644 --- a/src/plugins/_api/messageDecorations.ts +++ b/src/plugins/_api/messageDecorations.ts @@ -27,7 +27,7 @@ export default definePlugin({ { find: '"Message Username"', replacement: { - match: /\.Messages\.GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE.+?}\),\i(?=\])/, + match: /#intl.+?}\),\i(?=\])/, replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])" } } diff --git a/src/plugins/_api/messageEvents.ts b/src/plugins/_api/messageEvents.ts index 0347d5445..a7ddaa499 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.Arjix, Devs.hunt, Devs.Ven], patches: [ { - find: ".Messages.EDIT_TEXTAREA_HELP", + find: "#intl", replacement: { match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/, replace: (match, args) => "" + diff --git a/src/plugins/_api/messagePopover.ts b/src/plugins/_api/messagePopover.ts index 57b9b1193..c904017c9 100644 --- a/src/plugins/_api/messagePopover.ts +++ b/src/plugins/_api/messagePopover.ts @@ -24,9 +24,9 @@ export default definePlugin({ description: "API to add buttons to message popovers.", authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz], patches: [{ - find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL", + find: "#intl", replacement: { - match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.Messages\.MESSAGE_ACTION_REPLY.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/, + match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#intl.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/, replace: "$&,Vencord.Api.MessagePopover._buildPopoverElements($1,$2)" } }], diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 7904e78b0..6b14de70f 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -25,16 +25,16 @@ export default definePlugin({ description: "Api required for plugins that modify the server list", patches: [ { - find: "Messages.DISCODO_DISABLED", + find: "#intl", replacement: { - match: /(?<=Messages\.DISCODO_DISABLED.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/, + match: /(?<=#intl.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/, replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))" } }, { find: "Messages.SERVERS,children", replacement: { - match: /(?<=Messages\.SERVERS,children:)\i\.map\(\i\)/, + match: /(?<=#intl\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" } } diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 329c389c4..c99e606f3 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -57,7 +57,7 @@ export default definePlugin({ ] }, { - find: "Messages.ACTIVITY_SETTINGS", + find: "#intl", replacement: [ { match: /(?<=section:(.{0,50})\.DIVIDER\}\))([,;])(?=.{0,200}(\i)\.push.{0,100}label:(\i)\.header)/, @@ -70,7 +70,7 @@ export default definePlugin({ ] }, { - find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL", + find: "#intl", replacement: { match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/, replace: "$2.open($1);return;" diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index cb8d1d056..dee61a571 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -147,7 +147,7 @@ export default definePlugin({ settings, patches: [{ - find: ".BEGINNING_DM.format", + find: "#intl", replacement: { match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,300}(\i)\.isMultiUserDM)/, replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index fe5df48ad..dc95fabd3 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -69,7 +69,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED", + find: "#intl", group: true, replacement: [ { diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index bb1a67ebb..8a8de9d98 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -172,7 +172,7 @@ export default definePlugin({ // Disable expanding and collapsing folders transition in the normal GuildsBar sidebar { predicate: () => !settings.store.keepIcons, - match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/, + match: /(?<=#intl.+?useTransition\)\()/, replace: "$self.shouldShowTransition(arguments[0])&&" }, // If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded @@ -205,7 +205,7 @@ export default definePlugin({ } }, { - find: ".Messages.DISCODO_DISABLED", + find: "#intl", predicate: () => settings.store.closeAllHomeButton, replacement: { // Close all folders when clicking the home button diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 33d1d40b7..f3a28105e 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/, + match: /(?<=#intl\)},"decoration"\),)/, replace: "$self.DecorSection()," } }, diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index cb5634c8e..5cb2f6744 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ { find: ".PANEL}),nicknameIcons", replacement: { - match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id)}\)}\)/, + match: /#intl,.{0,100}userId:(\i\.id)}\)}\)/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})" } }, @@ -34,7 +34,7 @@ export default definePlugin({ { find: "action:\"PRESS_APP_CONNECTION\"", replacement: { - match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, + match: /#intl,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false})," } } diff --git a/src/plugins/memberCount/index.tsx b/src/plugins/memberCount/index.tsx index 85dcc4b2d..6809832a8 100644 --- a/src/plugins/memberCount/index.tsx +++ b/src/plugins/memberCount/index.tsx @@ -74,7 +74,7 @@ export default definePlugin({ { find: ".invitesDisabledTooltip", replacement: { - match: /\.VIEW_AS_ROLES_MENTIONS_WARNING.{0,100}(?=])/, + match: /#intl.{0,100}(?=])/, replace: "$&,$self.renderTooltip(arguments[0].guild)" }, predicate: () => settings.store.toolTip diff --git a/src/plugins/noUnblockToJump/index.ts b/src/plugins/noUnblockToJump/index.ts index cba6bb9aa..e22078808 100644 --- a/src/plugins/noUnblockToJump/index.ts +++ b/src/plugins/noUnblockToJump/index.ts @@ -28,21 +28,21 @@ export default definePlugin({ { find: '.id,"Search Results"', replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/, + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#intl)/, replace: "if(false)$1" } }, { find: "renderJumpButton()", replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/, + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#intl)/, replace: "if(false)$1" } }, { find: "flash:!0,returnMessageId", replacement: { - match: /.\?(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/, + match: /.\?(.{1,10}\.show\({.{1,50}#intl)/, replace: "false?$1" } } diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index c38b2d1a5..36b4ce41b 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -57,7 +57,7 @@ export default definePlugin({ patches: [ // Change the max volume for sliders to allow for values above 200 ...[ - ".Messages.USER_VOLUME", + "#intl", "currentVolume:" ].map(find => ({ find, diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index bae780109..f5d71c285 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -127,11 +127,11 @@ export default definePlugin({ replace: "return [true" }, { - match: /(?<=COPY_IMAGE_MENU_ITEM,)action:/, + match: /(?<=#intl,)action:/, replace: "action:()=>$self.copyImage(arguments[0]),oldAction:" }, { - match: /(?<=SAVE_IMAGE_MENU_ITEM,)action:/, + match: /(?<=#intl,)action:/, replace: "action:()=>$self.saveImage(arguments[0]),oldAction:" }, ] @@ -224,10 +224,10 @@ export default definePlugin({ { find: '("interactionUsernameProfile', replacement: - { - match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/, - replace: "true" - }, + { + match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/, + replace: "true" + }, } ], diff --git a/src/utils/intlHash.ts b/src/utils/intlHash.ts new file mode 100644 index 000000000..069f8f809 --- /dev/null +++ b/src/utils/intlHash.ts @@ -0,0 +1,53 @@ +/* eslint-disable simple-header/header */ + +/** + * discord-intl + * + * @copyright 2024 Discord, Inc. + * @link https://github.com/discord/discord-intl + * @license MIT + */ + + +import { hash as h64 } from "@intrnl/xxhash64"; + +const BASE64_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); +const IS_BIG_ENDIAN = (() => { + const array = new Uint8Array(4); + const view = new Uint32Array(array.buffer); + return !((view[0] = 1) & array[0]); +})(); + +function numberToBytes(number: number | bigint) { + number = BigInt(number); + const array: number[] = []; + const byteCount = Math.ceil(Math.floor(Math.log2(Number(number)) + 1) / 8); + for (let i = 0; i < byteCount; i++) { + array.unshift(Number((number >> BigInt(8 * i)) & BigInt(255))); + } + + const bytes = new Uint8Array(array); + // The native `hashToMessageKey` always works in Big/Network Endian bytes, so this array + // needs to be converted to the same endianness to get the same base64 result. + return IS_BIG_ENDIAN ? bytes : bytes.reverse(); +} + +/** + * Returns a consistent, short hash of the given key by first processing it through a hash digest, + * then encoding the first few bytes to base64. + * + * This function is specifically written to mirror the native backend hashing function used by + * `@discord/intl-loader-core`, to be able to hash names at runtime. + */ +export function runtimeHashMessageKey(key: string): string { + const hash = h64(key, 0); + const bytes = numberToBytes(hash); + return [ + BASE64_TABLE[bytes[0] >> 2], + BASE64_TABLE[((bytes[0] & 0x03) << 4) | (bytes[1] >> 4)], + BASE64_TABLE[((bytes[1] & 0x0f) << 2) | (bytes[2] >> 6)], + BASE64_TABLE[bytes[2] & 0x3f], + BASE64_TABLE[bytes[3] >> 2], + BASE64_TABLE[((bytes[3] & 0x03) << 4) | (bytes[3] >> 4)], + ].join(""); +} diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 87f3ce78c..b247dd138 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -16,12 +16,24 @@ * along with this program. If not, see . */ +import { runtimeHashMessageKey } from "./intlHash"; import { Patch, PatchReplacement, ReplaceFn } from "./types"; export function canonicalizeMatch(match: T): T { - if (typeof match === "string") return match; - const canonSource = match.source - .replaceAll("\\i", "[A-Za-z_$][\\w$]*"); + let partialCanon = typeof match === "string" ? match : match.source; + partialCanon = partialCanon.replaceAll(/#intl?<([A-Za-z_$][\w$]*)>/g, (_, key) => { + const hashed = runtimeHashMessageKey(key); + const isStr = typeof match === "string"; + + return /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed) + ? isStr ? `["${hashed}` : `(?:\\["${hashed}"\\])` + : isStr ? `.${hashed}` : `(?:\\.${hashed})`; + }); + + if (typeof match === "string") return partialCanon as T; + + const canonSource = partialCanon + .replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`); return new RegExp(canonSource, match.flags) as T; } From 40b948b626cd54752a228ab88ff2230ef07fc0af Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:14:48 -0300 Subject: [PATCH 04/28] switch syntax --- pnpm-lock.yaml | 124 +++++++++--------- src/plugins/_api/memberListDecorators.ts | 2 +- src/plugins/_api/messageAccessories.ts | 2 +- src/plugins/_api/messageDecorations.ts | 2 +- src/plugins/_api/messageEvents.ts | 2 +- src/plugins/_api/messagePopover.ts | 4 +- src/plugins/_api/serverList.ts | 8 +- src/plugins/_core/settings.tsx | 4 +- src/plugins/_core/supportHelper.tsx | 2 +- .../accountPanelServerProfile/index.tsx | 2 +- src/plugins/betterFolders/index.tsx | 4 +- src/plugins/decor/index.tsx | 2 +- src/plugins/friendsSince/index.tsx | 4 +- src/plugins/memberCount/index.tsx | 2 +- src/plugins/noUnblockToJump/index.ts | 6 +- src/plugins/volumeBooster/index.ts | 2 +- src/plugins/webContextMenus.web/index.ts | 4 +- src/utils/patches.ts | 13 +- 18 files changed, 95 insertions(+), 94 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eeec05365..a62c40cd6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,7 +9,7 @@ patchedDependencies: hash: japuwsqfkulviwgkm4kd2oi3ky path: patches/eslint-plugin-path-alias@2.1.0.patch eslint@9.8.0: - hash: pxhhii6sqtzo2kyx3geekthd3a + hash: xm46kqcmdgzlmm4aifkfpxaho4 path: patches/eslint@9.8.0.patch importers: @@ -46,7 +46,7 @@ importers: devDependencies: '@stylistic/eslint-plugin': specifier: ^2.6.1 - version: 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + version: 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) '@types/chrome': specifier: ^0.0.269 version: 0.0.269 @@ -79,22 +79,22 @@ importers: version: 0.15.18 eslint: specifier: ^9.8.0 - version: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + version: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-import-resolver-alias: specifier: ^1.1.2 - version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))) + version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))) eslint-plugin-path-alias: specifier: 2.1.0 - version: 2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + version: 2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) eslint-plugin-simple-header: specifier: ^1.1.1 version: 1.1.1 eslint-plugin-simple-import-sort: specifier: ^12.1.1 - version: 12.1.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + version: 12.1.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) eslint-plugin-unused-imports: specifier: ^4.0.1 - version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) highlight.js: specifier: 10.7.3 version: 10.7.3 @@ -133,7 +133,7 @@ importers: version: 5.5.4 typescript-eslint: specifier: ^8.0.0 - version: 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + version: 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) typescript-transform-paths: specifier: ^3.4.7 version: 3.4.7(typescript@5.5.4) @@ -2908,9 +2908,9 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': + '@eslint-community/eslint-utils@4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': dependencies: - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-visitor-keys: 3.4.2 '@eslint-community/regexpp@4.11.0': {} @@ -2996,49 +2996,49 @@ snapshots: '@sapphi-red/web-noise-suppressor@0.3.5': {} - '@stylistic/eslint-plugin-js@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': + '@stylistic/eslint-plugin-js@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': dependencies: '@types/eslint': 9.6.0 acorn: 8.12.1 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-visitor-keys: 4.0.0 espree: 10.1.0 - '@stylistic/eslint-plugin-jsx@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))': + '@stylistic/eslint-plugin-jsx@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) '@types/eslint': 9.6.0 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) estraverse: 5.3.0 picomatch: 4.0.2 - '@stylistic/eslint-plugin-plus@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@stylistic/eslint-plugin-plus@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: '@types/eslint': 9.6.0 - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin-ts@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@stylistic/eslint-plugin-ts@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) '@types/eslint': 9.6.0 - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin@2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@stylistic/eslint-plugin@2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) - '@stylistic/eslint-plugin-jsx': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) - '@stylistic/eslint-plugin-plus': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - '@stylistic/eslint-plugin-ts': 2.6.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@stylistic/eslint-plugin-js': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@stylistic/eslint-plugin-jsx': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) + '@stylistic/eslint-plugin-plus': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@stylistic/eslint-plugin-ts': 2.6.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) '@types/eslint': 9.6.0 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) transitivePeerDependencies: - supports-color - typescript @@ -3133,15 +3133,15 @@ snapshots: dependencies: '@types/node': 22.0.3 - '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) '@typescript-eslint/scope-manager': 8.0.0 - '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.0 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 @@ -3151,14 +3151,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: '@typescript-eslint/scope-manager': 8.0.0 '@typescript-eslint/types': 8.0.0 '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.6 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -3169,10 +3169,10 @@ snapshots: '@typescript-eslint/types': 8.0.0 '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -3198,13 +3198,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4)': + '@typescript-eslint/utils@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) '@typescript-eslint/scope-manager': 8.0.0 '@typescript-eslint/types': 8.0.0 '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) transitivePeerDependencies: - supports-color - typescript @@ -3856,9 +3856,9 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))): + eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))): dependencies: - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) eslint-import-resolver-node@0.3.9: dependencies: @@ -3868,17 +3868,17 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): + eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -3886,9 +3886,9 @@ snapshots: array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) hasown: 2.0.2 is-core-module: 2.15.0 is-glob: 4.0.3 @@ -3899,15 +3899,15 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-path-alias@2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): + eslint-plugin-path-alias@2.1.0(patch_hash=japuwsqfkulviwgkm4kd2oi3ky)(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): dependencies: - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) find-pkg: 2.0.0 get-tsconfig: 4.7.5 nanomatch: 1.2.13 @@ -3916,16 +3916,16 @@ snapshots: eslint-plugin-simple-header@1.1.1: {} - eslint-plugin-simple-import-sort@12.1.1(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): + eslint-plugin-simple-import-sort@12.1.1(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): dependencies: - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) - eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)): + eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)): dependencies: - eslint: 9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a) + eslint: 9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4) eslint-rule-composer: 0.3.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) eslint-rule-composer@0.3.0: {} @@ -3940,9 +3940,9 @@ snapshots: eslint-visitor-keys@4.0.0: {} - eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a): + eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4)) '@eslint-community/regexpp': 4.11.0 '@eslint/config-array': 0.17.1 '@eslint/eslintrc': 3.1.0 @@ -5240,11 +5240,11 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typescript-eslint@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4): + typescript-eslint@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4))(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=pxhhii6sqtzo2kyx3geekthd3a))(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4))(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=xm46kqcmdgzlmm4aifkfpxaho4))(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: diff --git a/src/plugins/_api/memberListDecorators.ts b/src/plugins/_api/memberListDecorators.ts index 8e5fe50a1..0dba3608f 100644 --- a/src/plugins/_api/memberListDecorators.ts +++ b/src/plugins/_api/memberListDecorators.ts @@ -31,7 +31,7 @@ export default definePlugin({ match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/, replace: "$&vencordProps=$1," }, { - match: /#intl(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/, + match: /#{intl::GUILD_OWNER}(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/, replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps))," } ] diff --git a/src/plugins/_api/messageAccessories.ts b/src/plugins/_api/messageAccessories.ts index dbf363387..0ba2a031d 100644 --- a/src/plugins/_api/messageAccessories.ts +++ b/src/plugins/_api/messageAccessories.ts @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.Cyn], patches: [ { - find: "#intl", + find: "#{intl::REMOVE_ATTACHMENT_BODY}", replacement: { match: /(?<=.container\)?,children:)(\[.+?\])/, replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)", diff --git a/src/plugins/_api/messageDecorations.ts b/src/plugins/_api/messageDecorations.ts index a5fb50c62..fb63a6dde 100644 --- a/src/plugins/_api/messageDecorations.ts +++ b/src/plugins/_api/messageDecorations.ts @@ -27,7 +27,7 @@ export default definePlugin({ { find: '"Message Username"', replacement: { - match: /#intl.+?}\),\i(?=\])/, + match: /#{intl::GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE}.+?}\),\i(?=\])/, replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])" } } diff --git a/src/plugins/_api/messageEvents.ts b/src/plugins/_api/messageEvents.ts index a7ddaa499..0101b02c8 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.Arjix, Devs.hunt, Devs.Ven], patches: [ { - find: "#intl", + find: "#{intl::EDIT_TEXTAREA_HELP}", replacement: { match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/, replace: (match, args) => "" + diff --git a/src/plugins/_api/messagePopover.ts b/src/plugins/_api/messagePopover.ts index c904017c9..21e5accde 100644 --- a/src/plugins/_api/messagePopover.ts +++ b/src/plugins/_api/messagePopover.ts @@ -24,9 +24,9 @@ export default definePlugin({ description: "API to add buttons to message popovers.", authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz], patches: [{ - find: "#intl", + find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}", replacement: { - match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#intl.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/, + match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#{intl::MESSAGE_ACTION_REPLY}.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/, replace: "$&,Vencord.Api.MessagePopover._buildPopoverElements($1,$2)" } }], diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 6b14de70f..6597c121c 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -25,16 +25,16 @@ export default definePlugin({ description: "Api required for plugins that modify the server list", patches: [ { - find: "#intl", + find: "#{intl::DISCODO_DISABLED}", replacement: { - match: /(?<=#intl.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/, + match: /(?<=#{intl::DISCODO_DISABLED}.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/, replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))" } }, { - find: "Messages.SERVERS,children", + find: "#{intl::SERVERS},children", replacement: { - match: /(?<=#intl\),children:)\i\.map\(\i\)/, + match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" } } diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index c99e606f3..939cf83a6 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -57,7 +57,7 @@ export default definePlugin({ ] }, { - find: "#intl", + find: "#{intl::ACTIVITY_SETTINGS}", replacement: [ { match: /(?<=section:(.{0,50})\.DIVIDER\}\))([,;])(?=.{0,200}(\i)\.push.{0,100}label:(\i)\.header)/, @@ -70,7 +70,7 @@ export default definePlugin({ ] }, { - find: "#intl", + find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}", replacement: { match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/, replace: "$2.open($1);return;" diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index dee61a571..326475098 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -147,7 +147,7 @@ export default definePlugin({ settings, patches: [{ - find: "#intl", + find: "#{intl::BEGINNING_DM}", replacement: { match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,300}(\i)\.isMultiUserDM)/, replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index dc95fabd3..fcecffb17 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -69,7 +69,7 @@ export default definePlugin({ patches: [ { - find: "#intl", + find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", group: true, replacement: [ { diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index 8a8de9d98..3af5af663 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -172,7 +172,7 @@ export default definePlugin({ // Disable expanding and collapsing folders transition in the normal GuildsBar sidebar { predicate: () => !settings.store.keepIcons, - match: /(?<=#intl.+?useTransition\)\()/, + match: /(?<=#{intl::SERVER_FOLDER_PLACEHOLDER}.+?useTransition\)\()/, replace: "$self.shouldShowTransition(arguments[0])&&" }, // If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded @@ -205,7 +205,7 @@ export default definePlugin({ } }, { - find: "#intl", + find: "#{intl::DISCODO_DISABLED}", predicate: () => settings.store.closeAllHomeButton, replacement: { // Close all folders when clicking the home button diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index f3a28105e..69a7a1a59 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=#intl\)},"decoration"\),)/, + match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/, replace: "$self.DecorSection()," } }, diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index 5cb2f6744..a2a1311d2 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ { find: ".PANEL}),nicknameIcons", replacement: { - match: /#intl,.{0,100}userId:(\i\.id)}\)}\)/, + match: /#{intl::USER_PROFILE_MEMBER_SINCE},.{0,100}userId:(\i\.id)}\)}\)/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})" } }, @@ -34,7 +34,7 @@ export default definePlugin({ { find: "action:\"PRESS_APP_CONNECTION\"", replacement: { - match: /#intl,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, + match: /#{intl::USER_PROFILE_MEMBER_SINCE},.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false})," } } diff --git a/src/plugins/memberCount/index.tsx b/src/plugins/memberCount/index.tsx index 6809832a8..67bbc4ce8 100644 --- a/src/plugins/memberCount/index.tsx +++ b/src/plugins/memberCount/index.tsx @@ -74,7 +74,7 @@ export default definePlugin({ { find: ".invitesDisabledTooltip", replacement: { - match: /#intl.{0,100}(?=])/, + match: /#{intl::VIEW_AS_ROLES_MENTIONS_WARNING}.{0,100}(?=])/, replace: "$&,$self.renderTooltip(arguments[0].guild)" }, predicate: () => settings.store.toolTip diff --git a/src/plugins/noUnblockToJump/index.ts b/src/plugins/noUnblockToJump/index.ts index e22078808..cde0e19e5 100644 --- a/src/plugins/noUnblockToJump/index.ts +++ b/src/plugins/noUnblockToJump/index.ts @@ -28,21 +28,21 @@ export default definePlugin({ { find: '.id,"Search Results"', replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#intl)/, + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, replace: "if(false)$1" } }, { find: "renderJumpButton()", replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#intl)/, + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, replace: "if(false)$1" } }, { find: "flash:!0,returnMessageId", replacement: { - match: /.\?(.{1,10}\.show\({.{1,50}#intl)/, + match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, replace: "false?$1" } } diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index 36b4ce41b..241111d41 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -57,7 +57,7 @@ export default definePlugin({ patches: [ // Change the max volume for sliders to allow for values above 200 ...[ - "#intl", + "#{intl::USER_VOLUME}", "currentVolume:" ].map(find => ({ find, diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index f5d71c285..4ed7e922d 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -127,11 +127,11 @@ export default definePlugin({ replace: "return [true" }, { - match: /(?<=#intl,)action:/, + match: /(?<=#{intl::COPY_IMAGE_MENU_ITEM},)action:/, replace: "action:()=>$self.copyImage(arguments[0]),oldAction:" }, { - match: /(?<=#intl,)action:/, + match: /(?<=#{intl::SAVE_IMAGE_MENU_ITEM},)action:/, replace: "action:()=>$self.saveImage(arguments[0]),oldAction:" }, ] diff --git a/src/utils/patches.ts b/src/utils/patches.ts index b247dd138..855432cc3 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -21,19 +21,20 @@ import { Patch, PatchReplacement, ReplaceFn } from "./types"; export function canonicalizeMatch(match: T): T { let partialCanon = typeof match === "string" ? match : match.source; - partialCanon = partialCanon.replaceAll(/#intl?<([A-Za-z_$][\w$]*)>/g, (_, key) => { + partialCanon = partialCanon.replaceAll(/#{intl::([A-Za-z_$][\w$]*)}/g, (_, key) => { const hashed = runtimeHashMessageKey(key); const isStr = typeof match === "string"; return /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed) - ? isStr ? `["${hashed}` : `(?:\\["${hashed}"\\])` - : isStr ? `.${hashed}` : `(?:\\.${hashed})`; + ? isStr ? `["${hashed}` : String.raw`(?:\["${hashed}"\])` + : isStr ? `.${hashed}` : String.raw`(?:\.${hashed})`; }); - if (typeof match === "string") return partialCanon as T; + if (typeof match === "string") { + return partialCanon as T; + } - const canonSource = partialCanon - .replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`); + const canonSource = partialCanon.replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`); return new RegExp(canonSource, match.flags) as T; } From f2130453388451e76c7b0ed15eec740cfa0fa3bb Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:43:13 -0300 Subject: [PATCH 05/28] Fix more patches --- src/plugins/_api/serverList.ts | 2 +- src/plugins/alwaysAnimate/index.ts | 2 +- src/plugins/anonymiseFileNames/index.tsx | 4 ++-- src/plugins/banger/index.ts | 2 +- src/plugins/betterGifAltText/index.ts | 4 ++-- src/plugins/betterNotes/index.tsx | 4 ++-- src/plugins/betterSessions/index.tsx | 2 +- src/plugins/betterSettings/index.tsx | 4 ++-- src/plugins/copyFileContents/index.tsx | 2 +- src/plugins/crashHandler/index.ts | 2 +- src/plugins/disableCallIdle/index.ts | 2 +- src/plugins/fakeNitro/index.tsx | 6 +++--- src/plugins/fakeProfileThemes/index.tsx | 2 +- src/plugins/forceOwnerCrown/index.ts | 2 +- src/plugins/friendsSince/index.tsx | 4 ++-- src/plugins/gameActivityToggle/index.tsx | 2 +- src/plugins/greetStickerPicker/index.tsx | 2 +- src/plugins/ignoreActivities/index.tsx | 4 ++-- src/plugins/implicitRelationships/index.ts | 4 ++-- src/plugins/invisibleChat.desktop/index.tsx | 2 +- src/plugins/loadingQuotes/index.ts | 2 +- src/plugins/messageLogger/index.tsx | 4 ++-- src/plugins/moreUserTags/index.tsx | 6 +++--- src/plugins/noBlockedMessages/index.ts | 2 +- src/plugins/noOnboardingDelay/index.ts | 2 +- src/plugins/normalizeMessageLinks/index.ts | 2 +- src/plugins/pauseInvitesForever/index.tsx | 6 +++--- src/plugins/permissionFreeWill/index.ts | 4 ++-- src/plugins/replyTimestamp/index.tsx | 2 +- src/plugins/reverseImageSearch/index.tsx | 2 +- src/plugins/roleColorEverywhere/index.tsx | 4 ++-- src/plugins/shikiCodeblocks.desktop/index.ts | 2 +- src/plugins/showAllMessageButtons/index.ts | 2 +- src/plugins/showHiddenChannels/index.tsx | 10 +++++----- src/plugins/showHiddenThings/index.ts | 2 +- src/plugins/showTimeoutDuration/index.tsx | 4 ++-- src/plugins/sortFriendRequests/index.tsx | 2 +- src/plugins/startupTimings/index.tsx | 2 +- src/plugins/themeAttributes/index.ts | 2 +- src/plugins/unlockedAvatarZoom/index.ts | 2 +- src/plugins/userVoiceShow/index.tsx | 2 +- src/plugins/validReply/index.ts | 4 ++-- src/plugins/webContextMenus.web/index.ts | 4 ++-- 43 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 6597c121c..dfd40de74 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -32,7 +32,7 @@ export default definePlugin({ } }, { - find: "#{intl::SERVERS},children", + find: "#{intl::SERVERS}),children", replacement: { match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" diff --git a/src/plugins/alwaysAnimate/index.ts b/src/plugins/alwaysAnimate/index.ts index 20cb4f974..97593990c 100644 --- a/src/plugins/alwaysAnimate/index.ts +++ b/src/plugins/alwaysAnimate/index.ts @@ -41,7 +41,7 @@ export default definePlugin({ }, { // Status emojis - find: ".Messages.GUILD_OWNER,", + find: "#{intl::GUILD_OWNER}", replacement: { match: /(?<=\.activityEmoji,.+?animate:)\i/, replace: "!0" diff --git a/src/plugins/anonymiseFileNames/index.tsx b/src/plugins/anonymiseFileNames/index.tsx index 0e97bc7f8..21f4e5c8a 100644 --- a/src/plugins/anonymiseFileNames/index.tsx +++ b/src/plugins/anonymiseFileNames/index.tsx @@ -86,9 +86,9 @@ export default definePlugin({ } }, { - find: ".Messages.ATTACHMENT_UTILITIES_SPOILER", + find: "#{intl::ATTACHMENT_UTILITIES_SPOILER}", replacement: { - match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}\i\.\i\.Messages\.ATTACHMENT_UTILITIES_SPOILER)/, + match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}#{intl::ATTACHMENT_UTILITIES_SPOILER})/, replace: "arguments[0].canEdit!==false?$self.renderIcon(arguments[0]):null," }, }, diff --git a/src/plugins/banger/index.ts b/src/plugins/banger/index.ts index eca80f9ee..f13fd3515 100644 --- a/src/plugins/banger/index.ts +++ b/src/plugins/banger/index.ts @@ -36,7 +36,7 @@ export default definePlugin({ settings, patches: [ { - find: "BAN_CONFIRM_TITLE.", + find: "#{intl::BAN_CONFIRM_TITLE}", replacement: { match: /src:\i\("?\d+"?\)/g, replace: "src:$self.source" diff --git a/src/plugins/betterGifAltText/index.ts b/src/plugins/betterGifAltText/index.ts index 55fa22525..5d9b188ea 100644 --- a/src/plugins/betterGifAltText/index.ts +++ b/src/plugins/betterGifAltText/index.ts @@ -34,9 +34,9 @@ export default definePlugin({ }, }, { - find: ".Messages.GIF,", + find: "#{intl::GIF}", replacement: { - match: /alt:(\i)=(\i\.\i\.Messages\.GIF)(?=,[^}]*\}=(\i))/, + match: /alt:(\i)=(\i\.\i\.string\(\i\.\i#{intl::GIF}\))(?=,[^}]*\}=(\i))/, replace: // rename prop so we can always use default value "alt_$$:$1=$self.altify($3)||$2", diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx index 63fcf6477..68aa70c61 100644 --- a/src/plugins/betterNotes/index.tsx +++ b/src/plugins/betterNotes/index.tsx @@ -63,9 +63,9 @@ export default definePlugin({ } }, { - find: "Messages.NOTE_PLACEHOLDER", + find: "#{intl::NOTE_PLACEHOLDER}", replacement: { - match: /\.NOTE_PLACEHOLDER,/, + match: /#{intl::NOTE_PLACEHOLDER}\),/, replace: "$&spellCheck:!$self.noSpellCheck," } } diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx index 598e01042..9347c398c 100644 --- a/src/plugins/betterSessions/index.tsx +++ b/src/plugins/betterSessions/index.tsx @@ -60,7 +60,7 @@ export default definePlugin({ patches: [ { - find: "Messages.AUTH_SESSIONS_SESSION_LOG_OUT", + find: "#{intl::AUTH_SESSIONS_SESSION_LOG_OUT}", replacement: [ // Replace children with a single label with state { diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index f0dd89a7a..15618faf1 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -111,7 +111,7 @@ export default definePlugin({ predicate: () => settings.store.disableFade }, { // Load menu TOC eagerly - find: "Messages.USER_SETTINGS_WITH_BUILD_OVERRIDE.format", + find: "#{intl::USER_SETTINGS_WITH_BUILD_OVERRIDE}", replacement: { match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/, replace: "$&(async ()=>$2)()," @@ -119,7 +119,7 @@ export default definePlugin({ predicate: () => settings.store.eagerLoad }, { // Settings cog context menu - find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL", + find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}", replacement: [ { match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/, diff --git a/src/plugins/copyFileContents/index.tsx b/src/plugins/copyFileContents/index.tsx index 13b649174..28b5bb92d 100644 --- a/src/plugins/copyFileContents/index.tsx +++ b/src/plugins/copyFileContents/index.tsx @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.Obsidian, Devs.Nuckyz], patches: [ { - find: ".Messages.PREVIEW_BYTES_LEFT.format(", + find: "#{intl::PREVIEW_BYTES_LEFT}", replacement: { match: /\.footerGap.+?url:\i,fileName:\i,fileSize:\i}\),(?<=fileContents:(\i),bytesLeft:(\i).+?)/g, replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2})," diff --git a/src/plugins/crashHandler/index.ts b/src/plugins/crashHandler/index.ts index 221b115f6..57703a56f 100644 --- a/src/plugins/crashHandler/index.ts +++ b/src/plugins/crashHandler/index.ts @@ -67,7 +67,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.ERRORS_UNEXPECTED_CRASH", + find: "#{intl:;ERRORS_UNEXPECTED_CRASH}", replacement: { match: /this\.setState\((.+?)\)/, replace: "$self.handleCrash(this,$1);" diff --git a/src/plugins/disableCallIdle/index.ts b/src/plugins/disableCallIdle/index.ts index c36fce6ca..1fdc862c1 100644 --- a/src/plugins/disableCallIdle/index.ts +++ b/src/plugins/disableCallIdle/index.ts @@ -27,7 +27,7 @@ export default definePlugin({ authors: [Devs.Nuckyz], patches: [ { - find: ".Messages.BOT_CALL_IDLE_DISCONNECT", + find: "#{intl::BOT_CALL_IDLE_DISCONNECT}", replacement: { match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/, replace: ";return;" diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index ca348c614..087bb5551 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -285,7 +285,7 @@ export default definePlugin({ }, // Remove boost requirements to stream with high quality { - find: "STREAM_FPS_OPTION.format", + find: "#{intl::STREAM_FPS_OPTION}", predicate: () => settings.store.enableStreamQualityBypass, replacement: { match: /guildPremiumTier:\i\.\i\.TIER_\d,?/g, @@ -356,7 +356,7 @@ export default definePlugin({ ] }, { - find: ".Messages.STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION.format", + find: "#{intl::STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION}", predicate: () => settings.store.transformStickers, replacement: [ { @@ -381,7 +381,7 @@ export default definePlugin({ } }, { - find: ".Messages.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION", + find: "#{intl::EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION}", predicate: () => settings.store.transformEmojis, replacement: { // Add the fake nitro emoji notice diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index 708c961aa..d546650bb 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -126,7 +126,7 @@ export default definePlugin({ } }, { - find: ".USER_SETTINGS_RESET_PROFILE_THEME", + find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}", replacement: { match: /RESET_PROFILE_THEME}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})" diff --git a/src/plugins/forceOwnerCrown/index.ts b/src/plugins/forceOwnerCrown/index.ts index 444bfab34..b21de4891 100644 --- a/src/plugins/forceOwnerCrown/index.ts +++ b/src/plugins/forceOwnerCrown/index.ts @@ -27,7 +27,7 @@ export default definePlugin({ authors: [Devs.D3SOX, Devs.Nickyux], patches: [ { - find: ".Messages.GUILD_OWNER,", + find: "#{intl::GUILD_OWNER}", replacement: { match: /,isOwner:(\i),/, replace: ",_isOwner:$1=$self.isGuildOwner(e)," diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index a2a1311d2..0f4016ad6 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ { find: ".PANEL}),nicknameIcons", replacement: { - match: /#{intl::USER_PROFILE_MEMBER_SINCE},.{0,100}userId:(\i\.id)}\)}\)/, + match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})" } }, @@ -34,7 +34,7 @@ export default definePlugin({ { find: "action:\"PRESS_APP_CONNECTION\"", replacement: { - match: /#{intl::USER_PROFILE_MEMBER_SINCE},.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, + match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id),.{0,100}}\)}\),/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false})," } } diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index 7aeb470d6..32d72fdbf 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -92,7 +92,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED", + find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", replacement: { match: /this\.renderNameZone\(\).+?children:\[/, replace: "$&$self.GameActivityToggleButton()," diff --git a/src/plugins/greetStickerPicker/index.tsx b/src/plugins/greetStickerPicker/index.tsx index 438fa40c6..3ab5fca41 100644 --- a/src/plugins/greetStickerPicker/index.tsx +++ b/src/plugins/greetStickerPicker/index.tsx @@ -166,7 +166,7 @@ export default definePlugin({ patches: [ { - find: "Messages.WELCOME_CTA_LABEL", + find: "#{intl::WELCOME_CTA_LABEL}", replacement: { match: /innerClassName:\i\.welcomeCTAButton,(?<={channel:\i,message:\i}=(\i).{0,400}?)/, replace: "$&onContextMenu:(vcEvent)=>$self.pickSticker(vcEvent, $1)," diff --git a/src/plugins/ignoreActivities/index.tsx b/src/plugins/ignoreActivities/index.tsx index 19f22e61d..fac83687d 100644 --- a/src/plugins/ignoreActivities/index.tsx +++ b/src/plugins/ignoreActivities/index.tsx @@ -260,9 +260,9 @@ export default definePlugin({ } }, { - find: ".Messages.SETTINGS_GAMES_TOGGLE_OVERLAY", + find: "#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}", replacement: { - match: /\.Messages\.SETTINGS_GAMES_TOGGLE_OVERLAY.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/, + match: /#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/, replace: (m, props, nowPlaying) => `${m}$self.renderToggleGameActivityButton(${props},${nowPlaying}),` } }, diff --git a/src/plugins/implicitRelationships/index.ts b/src/plugins/implicitRelationships/index.ts index 7fefb39b8..868e13550 100644 --- a/src/plugins/implicitRelationships/index.ts +++ b/src/plugins/implicitRelationships/index.ts @@ -32,7 +32,7 @@ export default definePlugin({ patches: [ // Counts header { - find: ".FRIENDS_ALL_HEADER", + find: "#{intl::FRIENDS_ALL_HEADER}", replacement: { match: /toString\(\)\}\);case (\i\.\i)\.BLOCKED/, replace: 'toString()});case $1.IMPLICIT:return "Implicit — "+arguments[1];case $1.BLOCKED' @@ -48,7 +48,7 @@ export default definePlugin({ }, // Sections header { - find: ".FRIENDS_SECTION_ONLINE", + find: "#{intl::FRIENDS_SECTION_ONLINE}", replacement: { match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.Messages\.BLOCKED\}\)/, replace: "$1.IMPLICIT,className:$2.item,children:\"Implicit\"}),$&" diff --git a/src/plugins/invisibleChat.desktop/index.tsx b/src/plugins/invisibleChat.desktop/index.tsx index c7eb29e7e..1af8f4e5d 100644 --- a/src/plugins/invisibleChat.desktop/index.tsx +++ b/src/plugins/invisibleChat.desktop/index.tsx @@ -111,7 +111,7 @@ export default definePlugin({ patches: [ { // Indicator - find: ".Messages.MESSAGE_EDITED,", + find: "#{intl::MESSAGE_EDITED}", replacement: { match: /let\{className:\i,message:\i[^}]*\}=(\i)/, replace: "try {$1 && $self.INV_REGEX.test($1.message.content) ? $1.content.push($self.indicator()) : null } catch {};$&" diff --git a/src/plugins/loadingQuotes/index.ts b/src/plugins/loadingQuotes/index.ts index 7d85cc90b..9bfc88a73 100644 --- a/src/plugins/loadingQuotes/index.ts +++ b/src/plugins/loadingQuotes/index.ts @@ -62,7 +62,7 @@ export default definePlugin({ patches: [ { - find: ".LOADING_DID_YOU_KNOW", + find: "#{intl::LOADING_DID_YOU_KNOW}", replacement: [ { match: /"_loadingText".+?(?=(\i)\[.{0,10}\.random)/, diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index a08aeccce..080be776b 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -445,7 +445,7 @@ export default definePlugin({ { // Message content renderer - find: "Messages.MESSAGE_EDITED,\")\"", + find: "#{intl::MESSAGE_EDITED}", replacement: [ { // Render editHistory in the deepest div for message content @@ -497,7 +497,7 @@ export default definePlugin({ }, { // Message group rendering - find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE", + find: "#{intl::NEW_MESSAGES_ESTIMATED_WITH_DATE}", replacement: [ { match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/, diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index 7a56131a5..119d02c3b 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -187,7 +187,7 @@ export default definePlugin({ } }, { - find: ".DISCORD_SYSTEM_MESSAGE_BOT_TAG_TOOLTIP_OFFICIAL,", + find: "#{intl::DISCORD_SYSTEM_MESSAGE_BOT_TAG_TOOLTIP_OFFICIAL}", replacement: [ // make the tag show the right text { @@ -217,7 +217,7 @@ export default definePlugin({ }, // in the member list { - find: ".Messages.GUILD_OWNER,", + find: "#{intl::GUILD_OWNER}", replacement: { match: /(?\i)=\(null==.{0,100}\.BOT;return null!=(?\i)&&\i\.bot/, replace: "$ = $self.getTag({user: $, channel: arguments[0].channel, origType: $.bot ? 0 : null, location: 'not-chat' }); return typeof $ === 'number'" @@ -232,7 +232,7 @@ export default definePlugin({ } }, { - find: ".Messages.USER_PROFILE_PRONOUNS", + find: "#{ìntl::USER_PROFILE_PRONOUNS}", replacement: { match: /(?=,hideBotTag:!0)/, replace: ",moreTags_channelId:arguments[0].moreTags_channelId" diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index d3b37b026..7884aa29c 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -37,7 +37,7 @@ export default definePlugin({ authors: [Devs.rushii, Devs.Samu], patches: [ { - find: "Messages.BLOCKED_MESSAGES_HIDE", + find: "#{intl::BLOCKED_MESSAGES_HIDE}", replacement: [ { match: /let\{[^}]*collapsedReason[^}]*\}/, diff --git a/src/plugins/noOnboardingDelay/index.ts b/src/plugins/noOnboardingDelay/index.ts index 6211e97c2..285109761 100644 --- a/src/plugins/noOnboardingDelay/index.ts +++ b/src/plugins/noOnboardingDelay/index.ts @@ -25,7 +25,7 @@ export default definePlugin({ authors: [Devs.nekohaxx], patches: [ { - find: "Messages.ONBOARDING_COVER_WELCOME_SUBTITLE", + find: "#{intl::ONBOARDING_COVER_WELCOME_SUBTITLE}", replacement: { match: "3e3", replace: "0" diff --git a/src/plugins/normalizeMessageLinks/index.ts b/src/plugins/normalizeMessageLinks/index.ts index cac36e65c..82076ef20 100644 --- a/src/plugins/normalizeMessageLinks/index.ts +++ b/src/plugins/normalizeMessageLinks/index.ts @@ -13,7 +13,7 @@ export default definePlugin({ authors: [Devs.bb010g], patches: [ { - find: ".Messages.COPY_MESSAGE_LINK,", + find: "#{intl::COPY_MESSAGE_LINK}", replacement: { match: /\.concat\(location\.host\)/, replace: ".concat($self.normalizeHost(location.host))", diff --git a/src/plugins/pauseInvitesForever/index.tsx b/src/plugins/pauseInvitesForever/index.tsx index 666f0af8e..ff292a6d2 100644 --- a/src/plugins/pauseInvitesForever/index.tsx +++ b/src/plugins/pauseInvitesForever/index.tsx @@ -43,15 +43,15 @@ export default definePlugin({ patches: [ { - find: "Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION", + find: "#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}", group: true, replacement: [ { - match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/, + match: /children:\i\.\i\.string\(\i\.\i#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}\)/, replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})", }, { - match: /\.INVITES_DISABLED\)(?=.+?\.Messages\.INVITES_PERMANENTLY_DISABLED_TIP.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/, + match: /\.INVITES_DISABLED\)(?=.+?#{intl::INVITES_PERMANENTLY_DISABLED_TIP}.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/, replace: "$&,setChecked=$2" } ] diff --git a/src/plugins/permissionFreeWill/index.ts b/src/plugins/permissionFreeWill/index.ts index 96e110b6a..c45cbff60 100644 --- a/src/plugins/permissionFreeWill/index.ts +++ b/src/plugins/permissionFreeWill/index.ts @@ -32,7 +32,7 @@ export default definePlugin({ patches: [ // Permission lockout, just set the check to true { - find: ".STAGE_CHANNEL_CANNOT_OVERWRITE_PERMISSION", + find: "#{intl::STAGE_CHANNEL_CANNOT_OVERWRITE_PERMISSION}", replacement: [ { match: /case"DENY":.{0,50}if\((?=\i\.\i\.can)/, @@ -43,7 +43,7 @@ export default definePlugin({ }, // Onboarding, same thing but we need to prevent the check { - find: ".ONBOARDING_CHANNEL_THRESHOLD_WARNING", + find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}", replacement: [ { match: /{(\i:function\(\){return \i},?){2}}/, diff --git a/src/plugins/replyTimestamp/index.tsx b/src/plugins/replyTimestamp/index.tsx index b0a01addb..a50640e9f 100644 --- a/src/plugins/replyTimestamp/index.tsx +++ b/src/plugins/replyTimestamp/index.tsx @@ -67,7 +67,7 @@ export default definePlugin({ patches: [ { - find: ".REPLY_QUOTE_MESSAGE_BLOCKED", + find: "#[intl::REPLY_QUOTE_MESSAGE_BLOCKED}", replacement: { match: /\.onClickReply,.+?}\),(?=\i,\i,\i\])/, replace: "$&$self.ReplyTimestamp(arguments[0])," diff --git a/src/plugins/reverseImageSearch/index.tsx b/src/plugins/reverseImageSearch/index.tsx index 728156b2b..eb87240c6 100644 --- a/src/plugins/reverseImageSearch/index.tsx +++ b/src/plugins/reverseImageSearch/index.tsx @@ -108,7 +108,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.MESSAGE_ACTIONS_MENU_LABEL,shouldHideMediaOptions", + find: "#{intl::MESSAGE_ACTIONS_MENU_LABEL}", replacement: { match: /favoriteableType:\i,(?<=(\i)\.getAttribute\("data-type"\).+?)/, replace: (m, target) => `${m}reverseImageSearchType:${target}.getAttribute("data-role"),` diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 108ed00c5..204bc0be3 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -104,7 +104,7 @@ export default definePlugin({ predicate: () => settings.store.memberList, }, { - find: ".Messages.THREAD_BROWSER_PRIVATE", + find: "#{intl::THREAD_BROWSER_PRIVATE}", replacement: [ { match: /children:\[\i," — ",\i\]/, @@ -132,7 +132,7 @@ export default definePlugin({ predicate: () => settings.store.reactorsList, }, { - find: '.Messages.MESSAGE_EDITED,")"', + find: "#{intl::MESSAGE_EDITED}", replacement: { match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/, replace: "style:{color:$self.useMessageColor($1)}," diff --git a/src/plugins/shikiCodeblocks.desktop/index.ts b/src/plugins/shikiCodeblocks.desktop/index.ts index e6676a866..1092f89a7 100644 --- a/src/plugins/shikiCodeblocks.desktop/index.ts +++ b/src/plugins/shikiCodeblocks.desktop/index.ts @@ -46,7 +46,7 @@ export default definePlugin({ } }, { - find: ".PREVIEW_NUM_LINES", + find: "#{intl::PREVIEW_NUM_LINES}", replacement: { match: /(?<=function \i\((\i)\)\{)(?=let\{text:\i,language:)/, replace: "return $self.renderHighlighter({lang:$1.language,content:$1.text});" diff --git a/src/plugins/showAllMessageButtons/index.ts b/src/plugins/showAllMessageButtons/index.ts index 44a5741cb..1d6890130 100644 --- a/src/plugins/showAllMessageButtons/index.ts +++ b/src/plugins/showAllMessageButtons/index.ts @@ -26,7 +26,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.MESSAGE_UTILITIES_A11Y_LABEL", + find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}", replacement: { match: /isExpanded:\i&&(.+?),/, replace: "isExpanded:$1," diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index d220d0c12..387303715 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -274,7 +274,7 @@ export default definePlugin({ } }, { - find: ".Messages.ROLE_REQUIRED_SINGLE_USER_MESSAGE", + find: "#{intl::ROLE_REQUIRED_SINGLE_USER_MESSAGE}", replacement: [ { // Change the role permission check to CONNECT if the channel is locked @@ -336,7 +336,7 @@ export default definePlugin({ ] }, { - find: ".Messages.CHANNEL_CALL_CURRENT_SPEAKER.format", + find: "#{intl::CHANNEL_CALL_CURRENT_SPEAKER}", replacement: [ { // Remove the divider and the open chat button for the HiddenChannelLockScreen @@ -351,7 +351,7 @@ export default definePlugin({ ] }, { - find: ".Messages.EMBEDDED_ACTIVITIES_DEVELOPER_ACTIVITY_SHELF_FETCH_ERROR", + find: "#{intl::EMBEDDED_ACTIVITIES_DEVELOPER_ACTIVITY_SHELF_FETCH_ERROR}", replacement: [ { // Render our HiddenChannelLockScreen component instead of the main voice channel component @@ -401,7 +401,7 @@ export default definePlugin({ ] }, { - find: ".Messages.STAGE_FULL_MODERATOR_TITLE", + find: "#{intl::STAGE_FULL_MODERATOR_TITLE}", replacement: [ { // Remove the divider and amount of users in stage channel components for the HiddenChannelLockScreen @@ -463,7 +463,7 @@ export default definePlugin({ ] }, { - find: ".Messages.FORM_LABEL_MUTED", + find: "#{intl::FORM_LABEL_MUTED}", replacement: { // Make GuildChannelStore.getChannels return hidden channels match: /(?<=getChannels\(\i)(?=\))/, diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index bab0b3032..8fd6ef82e 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -68,7 +68,7 @@ export default definePlugin({ }, // fixes a bug where Members page must be loaded to see highest role, why is Discord depending on MemberSafetyStore.getEnhancedMember for something that can be obtained here? { - find: "Messages.GUILD_MEMBER_MOD_VIEW_PERMISSION_GRANTED_BY_ARIA_LABEL,allowOverflow", + find: "#{intl::GUILD_MEMBER_MOD_VIEW_PERMISSION_GRANTED_BY_ARIA_LABEL}", predicate: () => settings.store.showModView, replacement: { match: /(role:)\i(?=,guildId.{0,100}role:(\i\[))/, diff --git a/src/plugins/showTimeoutDuration/index.tsx b/src/plugins/showTimeoutDuration/index.tsx index bfe806802..c0f5e918b 100644 --- a/src/plugins/showTimeoutDuration/index.tsx +++ b/src/plugins/showTimeoutDuration/index.tsx @@ -65,10 +65,10 @@ export default definePlugin({ patches: [ { - find: ".GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY", + find: "#{intl::GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY}", replacement: [ { - match: /(\i)\.Tooltip,{(text:.{0,30}\.Messages\.GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY)/, + match: /(\i)\.Tooltip,{(text:.{0,30}#{intl::GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY}\))/, replace: "$self.TooltipWrapper,{message:arguments[0].message,$2" } ] diff --git a/src/plugins/sortFriendRequests/index.tsx b/src/plugins/sortFriendRequests/index.tsx index 64eb13fe5..6ce1af14d 100644 --- a/src/plugins/sortFriendRequests/index.tsx +++ b/src/plugins/sortFriendRequests/index.tsx @@ -45,7 +45,7 @@ export default definePlugin({ replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()" } }, { - find: ".Messages.FRIEND_REQUEST_CANCEL", + find: "#{intl::FRIEND_REQUEST_CANCEL}", replacement: { predicate: () => settings.store.showDates, match: /subText:(\i)(?<=user:(\i).+?)/, diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index 5051fdf4a..aabc786a4 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ description: "Adds Startup Timings to the Settings menu", authors: [Devs.Megu], patches: [{ - find: "Messages.ACTIVITY_SETTINGS", + find: "#{intl::ACTIVITY_SETTINGS}", replacement: { match: /(?<=}\)([,;])(\i\.settings)\.forEach.+?(\i)\.push.+}\)}\))/, replace: (_, commaOrSemi, settings, elements) => "" + diff --git a/src/plugins/themeAttributes/index.ts b/src/plugins/themeAttributes/index.ts index 2a613967c..8e1e022b9 100644 --- a/src/plugins/themeAttributes/index.ts +++ b/src/plugins/themeAttributes/index.ts @@ -38,7 +38,7 @@ export default definePlugin({ // add --avatar-url- css variable to avatar img elements // popout profiles { - find: ".LABEL_WITH_ONLINE_STATUS", + find: "#{intl::LABEL_WITH_ONLINE_STATUS}", replacement: { match: /src:null!=\i\?(\i).{1,50}"aria-hidden":!0/, replace: "$&,style:$self.getAvatarStyles($1)" diff --git a/src/plugins/unlockedAvatarZoom/index.ts b/src/plugins/unlockedAvatarZoom/index.ts index 08503eb8b..79c204745 100644 --- a/src/plugins/unlockedAvatarZoom/index.ts +++ b/src/plugins/unlockedAvatarZoom/index.ts @@ -25,7 +25,7 @@ export default definePlugin({ settings, patches: [ { - find: ".Messages.AVATAR_UPLOAD_EDIT_MEDIA", + find: "#{intl::AVATAR_UPLOAD_EDIT_MEDIA}", replacement: { match: /maxValue:\d/, replace: "maxValue:$self.settings.store.zoomMultiplier", diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index 07b18c27d..0c8e30488 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -57,7 +57,7 @@ export default definePlugin({ patches: [ // User Popout, Full Size Profile, Direct Messages Side Profile { - find: ".Messages.USER_PROFILE_LOAD_ERROR", + find: "#{intl::USER_PROFILE_LOAD_ERROR}", replacement: { match: /(\.fetchError.+?\?)null/, replace: (_, rest) => `${rest}$self.VoiceChannelIndicator({userId:arguments[0]?.userId,isProfile:true})` diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index b65496f44..4e2b6b717 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -37,9 +37,9 @@ export default definePlugin({ authors: [Devs.newwares], patches: [ { - find: "Messages.REPLY_QUOTE_MESSAGE_NOT_LOADED", + find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED", replacement: { - match: /Messages\.REPLY_QUOTE_MESSAGE_NOT_LOADED/, + match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}\)/, replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" } }, diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index 4ed7e922d..3b2b58c0a 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -127,11 +127,11 @@ export default definePlugin({ replace: "return [true" }, { - match: /(?<=#{intl::COPY_IMAGE_MENU_ITEM},)action:/, + match: /(?<=#{intl::COPY_IMAGE_MENU_ITEM}\),)action:/, replace: "action:()=>$self.copyImage(arguments[0]),oldAction:" }, { - match: /(?<=#{intl::SAVE_IMAGE_MENU_ITEM},)action:/, + match: /(?<=#{intl::SAVE_IMAGE_MENU_ITEM}\),)action:/, replace: "action:()=>$self.saveImage(arguments[0]),oldAction:" }, ] From aef8a1a8b72e8a945080238d6cbf7e50a83f153e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:49:22 -0300 Subject: [PATCH 06/28] even more --- src/plugins/_api/serverList.ts | 2 +- src/plugins/crashHandler/index.ts | 2 +- src/plugins/disableCallIdle/index.ts | 2 +- src/plugins/permissionsViewer/index.tsx | 2 +- src/plugins/replyTimestamp/index.tsx | 2 +- src/plugins/showHiddenChannels/index.tsx | 2 +- src/plugins/validReply/index.ts | 2 +- src/plugins/webContextMenus.web/index.ts | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index dfd40de74..38bcfd905 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -32,7 +32,7 @@ export default definePlugin({ } }, { - find: "#{intl::SERVERS}),children", + find: '#{intl::SERVERS}"]),children', replacement: { match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" diff --git a/src/plugins/crashHandler/index.ts b/src/plugins/crashHandler/index.ts index 57703a56f..f6bc2c8b0 100644 --- a/src/plugins/crashHandler/index.ts +++ b/src/plugins/crashHandler/index.ts @@ -67,7 +67,7 @@ export default definePlugin({ patches: [ { - find: "#{intl:;ERRORS_UNEXPECTED_CRASH}", + find: "#{intl::ERRORS_UNEXPECTED_CRASH}", replacement: { match: /this\.setState\((.+?)\)/, replace: "$self.handleCrash(this,$1);" diff --git a/src/plugins/disableCallIdle/index.ts b/src/plugins/disableCallIdle/index.ts index 1fdc862c1..82ab56f2c 100644 --- a/src/plugins/disableCallIdle/index.ts +++ b/src/plugins/disableCallIdle/index.ts @@ -27,7 +27,7 @@ export default definePlugin({ authors: [Devs.Nuckyz], patches: [ { - find: "#{intl::BOT_CALL_IDLE_DISCONNECT}", + find: "#{intl::BOT_CALL_IDLE_DISCONNECT_2}", replacement: { match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/, replace: ";return;" diff --git a/src/plugins/permissionsViewer/index.tsx b/src/plugins/permissionsViewer/index.tsx index 7d6572df5..20b0b1910 100644 --- a/src/plugins/permissionsViewer/index.tsx +++ b/src/plugins/permissionsViewer/index.tsx @@ -170,7 +170,7 @@ export default definePlugin({ patches: [ { - find: ".VIEW_ALL_ROLES,", + find: "#{intl::VIEW_ALL_ROLES}", replacement: { match: /\.expandButton,.+?null,/, replace: "$&$self.ViewPermissionsButton(arguments[0])," diff --git a/src/plugins/replyTimestamp/index.tsx b/src/plugins/replyTimestamp/index.tsx index a50640e9f..dc31dd883 100644 --- a/src/plugins/replyTimestamp/index.tsx +++ b/src/plugins/replyTimestamp/index.tsx @@ -67,7 +67,7 @@ export default definePlugin({ patches: [ { - find: "#[intl::REPLY_QUOTE_MESSAGE_BLOCKED}", + find: "#{intl::REPLY_QUOTE_MESSAGE_BLOCKED}", replacement: { match: /\.onClickReply,.+?}\),(?=\i,\i,\i\])/, replace: "$&$self.ReplyTimestamp(arguments[0])," diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 387303715..ba3675428 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -149,7 +149,7 @@ export default definePlugin({ } }, { - find: ".Messages.CHANNEL_TOOLTIP_DIRECTORY", + find: "#{intl::CHANNEL_TOOLTIP_DIRECTORY}", predicate: () => settings.store.showMode === ShowMode.LockIcon, replacement: { // Lock Icon diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 4e2b6b717..989513d01 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -37,7 +37,7 @@ export default definePlugin({ authors: [Devs.newwares], patches: [ { - find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED", + find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", replacement: { match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}\)/, replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index 3b2b58c0a..d3934bc26 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -202,14 +202,14 @@ export default definePlugin({ } }, { - find: ".Messages.SEARCH_WITH_GOOGLE", + find: "#{intl::SEARCH_WITH_GOOGLE}", replacement: { match: /\i\.isPlatformEmbedded/, replace: "true" } }, { - find: ".Messages.COPY,hint:", + find: "#{intl::COPY}),hint:", replacement: [ { match: /\i\.isPlatformEmbedded/, From d099aff45a370aea867fb7607e8e3907cb426bac Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:58:43 -0300 Subject: [PATCH 07/28] and more --- src/plugins/_core/supportHelper.tsx | 2 +- src/plugins/fakeProfileThemes/index.tsx | 2 +- src/plugins/moreUserTags/index.tsx | 2 +- src/plugins/validReply/index.ts | 2 +- src/utils/index.ts | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index 326475098..f76773b35 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -149,7 +149,7 @@ export default definePlugin({ patches: [{ find: "#{intl::BEGINNING_DM}", replacement: { - match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,300}(\i)\.isMultiUserDM)/, + match: /#{intl::BEGINNING_DM}"],{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," } }], diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index d546650bb..b1cce7251 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -128,7 +128,7 @@ export default definePlugin({ { find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}", replacement: { - match: /RESET_PROFILE_THEME}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, + match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})" } } diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index 119d02c3b..c6695d313 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -232,7 +232,7 @@ export default definePlugin({ } }, { - find: "#{ìntl::USER_PROFILE_PRONOUNS}", + find: "#{intl::USER_PROFILE_PRONOUNS}", replacement: { match: /(?=,hideBotTag:!0)/, replace: ",moreTags_channelId:arguments[0].moreTags_channelId" diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 989513d01..5e9f8beda 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -39,7 +39,7 @@ export default definePlugin({ { find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", replacement: { - match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}\)/, + match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}"]\)/, replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" } }, diff --git a/src/utils/index.ts b/src/utils/index.ts index 62f3f6e96..ed347fdc5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -22,6 +22,7 @@ export * from "./ChangeList"; export * from "./constants"; export * from "./discord"; export * from "./guards"; +export * from "./intlHash"; export * from "./lazy"; export * from "./lazyReact"; export * from "./localStorage"; From e0098deaab5c8a07801c3822ac24a02e0b47ee0e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:01:56 -0300 Subject: [PATCH 08/28] lets work alright? --- src/utils/patches.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 855432cc3..5411ff37d 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -26,7 +26,7 @@ export function canonicalizeMatch(match: T): T { const isStr = typeof match === "string"; return /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed) - ? isStr ? `["${hashed}` : String.raw`(?:\["${hashed}"\])` + ? isStr ? `["${hashed}` : String.raw`(?:\["${hashed})` : isStr ? `.${hashed}` : String.raw`(?:\.${hashed})`; }); From fe69a03e7ca957b3d8c3cc5f827620d6d8034464 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:05:09 -0500 Subject: [PATCH 09/28] i18n --- src/equicordplugins/anammox/index.ts | 8 ++++---- src/equicordplugins/bannersEverywhere/index.tsx | 2 +- src/equicordplugins/betterBanReasons/index.tsx | 4 ++-- src/equicordplugins/betterInvites/index.tsx | 4 ++-- src/equicordplugins/betterQuickReact/index.tsx | 2 +- src/equicordplugins/betterUserArea/index.tsx | 2 +- src/equicordplugins/clientSideBlock/index.tsx | 2 +- src/equicordplugins/customTimestamps/index.tsx | 2 +- src/equicordplugins/deadMembers/index.tsx | 2 +- src/equicordplugins/frequentQuickSwitcher/index.tsx | 2 +- src/equicordplugins/friendTags/index.tsx | 2 +- src/equicordplugins/fullUserInChatbox/index.tsx | 2 +- src/equicordplugins/hideServers/index.tsx | 4 ++-- src/equicordplugins/homeTyping/index.tsx | 2 +- src/equicordplugins/identity/index.tsx | 2 +- src/equicordplugins/ignoreTerms/index.ts | 2 +- src/equicordplugins/keywordNotify/index.tsx | 4 ++-- src/equicordplugins/loginWithQR/index.tsx | 6 +++--- src/equicordplugins/messageLinkTooltip/index.tsx | 4 ++-- src/equicordplugins/moreStickers/index.tsx | 8 ++++---- src/equicordplugins/pinIcon/index.tsx | 4 ++-- src/equicordplugins/showBadgesInChat/index.tsx | 2 +- src/equicordplugins/sidebarChat/index.tsx | 2 +- src/equicordplugins/statusPresets/index.tsx | 6 +++--- src/equicordplugins/whitelistedEmojis/index.tsx | 2 +- src/equicordplugins/youtubeDescription/index.tsx | 2 +- 26 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/equicordplugins/anammox/index.ts b/src/equicordplugins/anammox/index.ts index 64b55a52c..1bf05abb6 100644 --- a/src/equicordplugins/anammox/index.ts +++ b/src/equicordplugins/anammox/index.ts @@ -74,10 +74,10 @@ export default definePlugin({ }, { // Settings, sidebar - find: "Messages.BILLING_SETTINGS", + find: "#{intl::BILLING_SETTINGS}", replacement: [ { - match: /(?<=Messages.BILLING_SETTINGS,)/, + match: /(?<=#{intl::BILLING_SETTINGS},)/, replace: "capitalism:true," }, { @@ -99,7 +99,7 @@ export default definePlugin({ }, { // Emoji list - find: "isEmojiCategoryNitroLocked({", + find: "#{intl::EMOJI_PICKER_CREATE_EMOJI_TITLE},size:", replacement: { match: /(\i)=\i\|\|!\i&&\i.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/, replace: "$&$1||" @@ -108,7 +108,7 @@ export default definePlugin({ }, { // Emoji category list - find: "EMOJI_PICKER_REACTION_EMOJI_CLICKED;", + find: "#{intl::EMOJI_CATEGORY_TOP_GUILD_EMOJI}", replacement: { match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/, replace: "$2.isNitroLocked||" diff --git a/src/equicordplugins/bannersEverywhere/index.tsx b/src/equicordplugins/bannersEverywhere/index.tsx index 128a43562..88b8ecec0 100644 --- a/src/equicordplugins/bannersEverywhere/index.tsx +++ b/src/equicordplugins/bannersEverywhere/index.tsx @@ -39,7 +39,7 @@ export default definePlugin({ settings, patches: [ { - find: "MEMBER_LIST,tagUserId", + find: "#{intl::GUILD_OWNER},", replacement: { // We add the banner as a property while we can still access the user id diff --git a/src/equicordplugins/betterBanReasons/index.tsx b/src/equicordplugins/betterBanReasons/index.tsx index 407e7efc3..452fe827d 100644 --- a/src/equicordplugins/betterBanReasons/index.tsx +++ b/src/equicordplugins/betterBanReasons/index.tsx @@ -72,9 +72,9 @@ export default definePlugin({ authors: [Devs.Inbestigator], patches: [ { - find: "banReasonOtherClickable,children", + find: "#{intl::BAN_MULTIPLE_CONFIRM_TITLE}", replacement: [{ - match: /\[\{name:\i\.\i.+?\}\]/, + match: /\[\{name:#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}.+?\}\]/, replace: "$self.getReasons()" }, { diff --git a/src/equicordplugins/betterInvites/index.tsx b/src/equicordplugins/betterInvites/index.tsx index 10859f195..8a98f95db 100644 --- a/src/equicordplugins/betterInvites/index.tsx +++ b/src/equicordplugins/betterInvites/index.tsx @@ -37,10 +37,10 @@ export default definePlugin({ authors: [EquicordDevs.iamme], patches: [ { - find: ".GuildSplash,{guild", + find: "#{intl::HUB_INVITE_ANOTHER_SCHOOL_LINK}", replacement: [ { - match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.{0,50}text:)(\i.{0,50}]\))/, + match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(#{intl::Messages.GUEST_MEMBERSHIP_EXPLANATION})/, replace: ",($1||((!$1)&&arguments[0].invite.expires_at)) && $2$self.RenderTip($1, $3, arguments[0].invite.expires_at)" }, { diff --git a/src/equicordplugins/betterQuickReact/index.tsx b/src/equicordplugins/betterQuickReact/index.tsx index 6a47d9b07..85b3b12e9 100644 --- a/src/equicordplugins/betterQuickReact/index.tsx +++ b/src/equicordplugins/betterQuickReact/index.tsx @@ -59,7 +59,7 @@ export default definePlugin({ } }, { - find: "allNamesString,hideOnClick", + find: "#{intl::ADD_REACTION_NAMED}", group: true, replacement: [ // Override limit of emojis to display with offset hook. diff --git a/src/equicordplugins/betterUserArea/index.tsx b/src/equicordplugins/betterUserArea/index.tsx index bf77374a0..06c72bc5c 100644 --- a/src/equicordplugins/betterUserArea/index.tsx +++ b/src/equicordplugins/betterUserArea/index.tsx @@ -15,7 +15,7 @@ export default definePlugin({ description: "Reworks the user area styling to fit more buttons and overall look nicer", authors: [Devs.Samwich], patches: [{ - find: "handleToggleSelfMute,onContextMenu", + find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", replacement: [ // add a custom class to make things easier diff --git a/src/equicordplugins/clientSideBlock/index.tsx b/src/equicordplugins/clientSideBlock/index.tsx index b16b6aeb0..2301322ce 100644 --- a/src/equicordplugins/clientSideBlock/index.tsx +++ b/src/equicordplugins/clientSideBlock/index.tsx @@ -167,7 +167,7 @@ export default definePlugin({ }, // "1 blocked message" { - find: "blockedAction,children", + find: "#{intl::BLOCKED_MESSAGES_HIDE}", replacement: { match: /\i.memo\(function\(\i\){/, replace: "$&return null;" diff --git a/src/equicordplugins/customTimestamps/index.tsx b/src/equicordplugins/customTimestamps/index.tsx index e6c3e37f7..9644c0911 100644 --- a/src/equicordplugins/customTimestamps/index.tsx +++ b/src/equicordplugins/customTimestamps/index.tsx @@ -67,7 +67,7 @@ export default definePlugin({ ), patches: [{ - find: "timestampTooltip,delay", + find: "#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}", replacement: [ { match: /(?<=\i=\i\?)\(0,\i\.\i\)\((\i),"LT"\):\(0,\i\.\i\)\(\i\)/, diff --git a/src/equicordplugins/deadMembers/index.tsx b/src/equicordplugins/deadMembers/index.tsx index b92c00544..1da633c83 100644 --- a/src/equicordplugins/deadMembers/index.tsx +++ b/src/equicordplugins/deadMembers/index.tsx @@ -22,7 +22,7 @@ export default definePlugin({ } }, { - find: "stopPropagation:!0,ariaLabel", + find: "#{intl::FORUM_POST_AUTHOR_A11Y_LABEL}", replacement: { match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/, replace: "$self.wrapForumAuthor({...$1,$2},$&)" diff --git a/src/equicordplugins/frequentQuickSwitcher/index.tsx b/src/equicordplugins/frequentQuickSwitcher/index.tsx index d2a4d87ad..c2d61a11e 100644 --- a/src/equicordplugins/frequentQuickSwitcher/index.tsx +++ b/src/equicordplugins/frequentQuickSwitcher/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ generateSearchResults: generateSearchResults, patches: [ { - find: "query,spellCheck:!1,autoFocus", + find: "#{intl::QUICKSWITCHER_PLACEHOLDER}", replacement: { match: /let{selectedIndex:\i,results:\i}/, replace: "this.props.results = $self.generateSearchResults(this.state.query);$&" diff --git a/src/equicordplugins/friendTags/index.tsx b/src/equicordplugins/friendTags/index.tsx index 00311196b..7cf3b2ef7 100644 --- a/src/equicordplugins/friendTags/index.tsx +++ b/src/equicordplugins/friendTags/index.tsx @@ -212,7 +212,7 @@ export default definePlugin({ queryFriendTags: queryFriendTags, patches: [ { - find: "query,spellCheck:!1,autoFocus", + find: "#{intl::QUICKSWITCHER_PLACEHOLDER}", replacement: { match: /let{selectedIndex:\i,results:\i}/, replace: "if(this.state.query.includes(\"&\")){ this.props.results = $self.queryFriendTags(this.state.query); }$&" diff --git a/src/equicordplugins/fullUserInChatbox/index.tsx b/src/equicordplugins/fullUserInChatbox/index.tsx index 10afc47f0..3b30541c1 100644 --- a/src/equicordplugins/fullUserInChatbox/index.tsx +++ b/src/equicordplugins/fullUserInChatbox/index.tsx @@ -17,7 +17,7 @@ export default definePlugin({ patches: [ { - find: "colorString,background", + find: "#{intl::UNKNOWN_ROLE_PLACEHOLDER}", replacement: { match: /(hidePersonalInformation.*?)return/, replace: "$1return $self.patchChatboxMention(arguments[0]);" diff --git a/src/equicordplugins/hideServers/index.tsx b/src/equicordplugins/hideServers/index.tsx index bff5ea404..569001637 100644 --- a/src/equicordplugins/hideServers/index.tsx +++ b/src/equicordplugins/hideServers/index.tsx @@ -77,7 +77,7 @@ export default definePlugin({ find: '("guildsnav")', replacement: [ { - match: /(?<=onActivate.{0,100},children:.{0,300}?)(\i)(\)?\.map\(\i\))/, + match: /(?<=#{intl::SERVERS},children:.{0,300}?)(\i)(\)?\.map\(\i\))/, replace: "$self.useFilteredGuilds($1)$2", }, // despite my best efforts, the above doesnt trigger a rerender @@ -88,7 +88,7 @@ export default definePlugin({ ] }, { - find: '"quick-switcher-".concat', + find: "#{intl::QUICKSWITCHER_PROTIP}", replacement: { match: /(?<=renderResults\(\){)let{query/, replace: "this.props.results = $self.filteredGuildResults(this.props.results);$&", diff --git a/src/equicordplugins/homeTyping/index.tsx b/src/equicordplugins/homeTyping/index.tsx index ef6ec3277..7331753e0 100644 --- a/src/equicordplugins/homeTyping/index.tsx +++ b/src/equicordplugins/homeTyping/index.tsx @@ -26,7 +26,7 @@ export default definePlugin({ }, patches: [ { - find: "downloadProgress,determineOwnVisibility", + find: "#{intl::DISCODO_DISABLED}", replacement: [ { diff --git a/src/equicordplugins/identity/index.tsx b/src/equicordplugins/identity/index.tsx index fc273aa4c..729f5832e 100644 --- a/src/equicordplugins/identity/index.tsx +++ b/src/equicordplugins/identity/index.tsx @@ -140,7 +140,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=sectionTitle:.{0,50}]\)},"decoration"\),)/, + match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}},"decoration"\),)/, replace: "$self.ResetCard()," } }, diff --git a/src/equicordplugins/ignoreTerms/index.ts b/src/equicordplugins/ignoreTerms/index.ts index 809850847..9fd92261d 100644 --- a/src/equicordplugins/ignoreTerms/index.ts +++ b/src/equicordplugins/ignoreTerms/index.ts @@ -13,7 +13,7 @@ export default definePlugin({ authors: [Devs.D3SOX], patches: [ { - find: "USER_AGREEMENTS,properties", + find: "#{intl::NEW_TERMS_TITLE}", replacement: { match: /function (\i)\((\i)\)\{let\{transitionState:(\i)\}=(\i)/g, replace: "function $1($2){return $self.closeModal($2);let{transitionState:$3}=$4" diff --git a/src/equicordplugins/keywordNotify/index.tsx b/src/equicordplugins/keywordNotify/index.tsx index 54d021480..f4e15bcc3 100644 --- a/src/equicordplugins/keywordNotify/index.tsx +++ b/src/equicordplugins/keywordNotify/index.tsx @@ -33,7 +33,7 @@ const recentMentionsPopoutClass = findByPropsLazy("recentMentionsPopout"); const tabClass = findByPropsLazy("inboxTitle", "tab"); const buttonClass = findByPropsLazy("size36"); const MenuHeader = findByCodeLazy(".getUnseenInviteCount())"); -const Popout = findByCodeLazy(".trackJump", "canCloseAllMessages:"); +const Popout = findByCodeLazy("#{intl::UNBLOCK_TO_JUMP_TITLE}", "canCloseAllMessages:"); const createMessageRecord = findByCodeLazy(".createFromServer(", ".isBlockedForMessage", "messageReference:"); const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries"; const KEYWORD_LOG_KEY = "KeywordNotify_log"; @@ -313,7 +313,7 @@ export default definePlugin({ settings, patches: [ { - find: "TODOS,className", + find: "#{intl::UNREADS_TAB_LABEL}", replacement: { match: /\i\?\(0,\i\.jsxs\)\(\i\.TabBar\.Item/, replace: "$self.keywordTabBar(),$&" diff --git a/src/equicordplugins/loginWithQR/index.tsx b/src/equicordplugins/loginWithQR/index.tsx index b1d3d3062..14be1b8bc 100644 --- a/src/equicordplugins/loginWithQR/index.tsx +++ b/src/equicordplugins/loginWithQR/index.tsx @@ -58,13 +58,13 @@ export default definePlugin({ replacement: { // Find the Edit User Profile button and insert our custom button. // A bit jank, but whatever - match: /,(.{0,10}\.Button.{0,50},children:.{0,50}}\))]/, - replace: ",$self.insertScanQrButton($1)]", + match: /,(.{11}\.Button,.{58}\.USER_SETTINGS_EDIT_USER_PROFILE}\))/, + replace: ",$self.insertScanQrButton($1)", }, }, // Insert a Scan QR Code MenuItem in the Swith Accounts popout { - find: 'id:"manage-accounts"', + find: "#{intl::SWITCH_ACCOUNTS_MANAGE_ACCOUNTS},", replacement: { match: /(id:"manage-accounts",.*?)}\)\)(,\i)/, replace: "$1}),$self.ScanQrMenuItem)$2" diff --git a/src/equicordplugins/messageLinkTooltip/index.tsx b/src/equicordplugins/messageLinkTooltip/index.tsx index b5f152cb6..891166588 100644 --- a/src/equicordplugins/messageLinkTooltip/index.tsx +++ b/src/equicordplugins/messageLinkTooltip/index.tsx @@ -101,7 +101,7 @@ export default definePlugin({ predicate: () => settings.store.onLink, }, { - find: ".NOT_LOADED:", + find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", replacement: { // Should match two places match: /(\i\.Clickable),\{/g, @@ -110,7 +110,7 @@ export default definePlugin({ predicate: () => settings.store.onReply, }, { - find: "TEXT_LOW_CONTRAST})]", + find: "#{intl::MESSAGE_FORWARDED}", replacement: { match: /(\i\.Clickable),\{/, replace: "$self.ForwardTooltip,{Component:$1,vcProps:arguments[0]," diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 0d7094c04..f2083e552 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -32,7 +32,7 @@ export default definePlugin({ patches: [ { - find: "STICKER_BUTTON_LABEL,", + find: "#{intl::STICKER_BUTTON_LABEL},", replacement: [{ match: /(children:\(0,\w\.jsx\)\()([\w.]+?)(,{innerClassName.{10,30}\.stickerButton)/, replace: (_, head, button, tail) => { @@ -64,11 +64,11 @@ export default definePlugin({ } }, { - find: "GIF,children", + find: "#{intl::EXPRESSION_PICKER_GIF}", replacement: { - match: /role:"tablist","aria-label":.{0,50},children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, + match: /role:"tablist",.+?#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL},children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, replace: m => { - const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,50}]\)).*?:null/s; + const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,10}#{intl::EXPRESSION_PICKER_STICKER}).*?:null/s; const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => { const isActive = `${currentTab}==="stickers+"`; return ( diff --git a/src/equicordplugins/pinIcon/index.tsx b/src/equicordplugins/pinIcon/index.tsx index 1bc5a04a8..bd13a5c1a 100644 --- a/src/equicordplugins/pinIcon/index.tsx +++ b/src/equicordplugins/pinIcon/index.tsx @@ -27,9 +27,9 @@ export default definePlugin({ authors: [EquicordDevs.iamme], patches: [ { - find: "editedTimestamp,isEdited", + find: "#{intl::MESSAGE_EDITED},", replacement: { - match: /editedTimestamp,isEdited(?:[^}]*[}]){3}\)/, + match: /#{intl::MESSAGE_EDITED},(?:[^}]*[}]){3}\)/, replace: "$&,$self.PinnedIcon(arguments[0].message)" } } diff --git a/src/equicordplugins/showBadgesInChat/index.tsx b/src/equicordplugins/showBadgesInChat/index.tsx index beaac0de2..7d09e81f9 100644 --- a/src/equicordplugins/showBadgesInChat/index.tsx +++ b/src/equicordplugins/showBadgesInChat/index.tsx @@ -11,7 +11,7 @@ import definePlugin from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import badges from "plugins/_api/badges"; const roleIconClassName = findByPropsLazy("roleIcon", "separator").roleIcon; -const RoleIconComponent = findComponentByCodeLazy(".roleIcon", ".clickable"); +const RoleIconComponent = findComponentByCodeLazy("#{intl::ROLE_ICON_ALT_TEXT}"); import "./styles.css"; import { User } from "discord-types/general"; diff --git a/src/equicordplugins/sidebarChat/index.tsx b/src/equicordplugins/sidebarChat/index.tsx index 4302cefd2..8614e7292 100644 --- a/src/equicordplugins/sidebarChat/index.tsx +++ b/src/equicordplugins/sidebarChat/index.tsx @@ -34,7 +34,7 @@ const { HeaderBar, HeaderBarIcon } = mapMangledModuleLazy(".themedMobile]:", { }); const Chat = findComponentByCodeLazy("filterAfterTimestamp:", "chatInputType"); const Resize = findComponentByCodeLazy("sidebarType:", "homeSidebarWidth"); -const ChannelHeader = findComponentByCodeLazy(".GUILD_DIRECTORY", ".HUB"); +const ChannelHeader = findComponentByCodeLazy("#{intl::HUB_DIRECTORY_CHANNEL_TITLE}"); const ChatInputTypes = findByPropsLazy("FORM", "NORMAL"); const Sidebars = findByPropsLazy("ThreadSidebar", "MessageRequestSidebar"); diff --git a/src/equicordplugins/statusPresets/index.tsx b/src/equicordplugins/statusPresets/index.tsx index 7506ca167..ddebc3162 100644 --- a/src/equicordplugins/statusPresets/index.tsx +++ b/src/equicordplugins/statusPresets/index.tsx @@ -131,14 +131,14 @@ export default definePlugin({ dependencies: ["UserSettingsAPI"], patches: [ { - find: "analyticsLocation,children", + find: "#{intl::CUSTOM_STATUS_SET_CUSTOM_STATUS}", replacement: { - match: /\.ModalFooter,.{0,70}\.handleSubmit.{0,50}\}\)/, + match: /\.ModalFooter,.{0,70}\.Messages\.SAVE\}\)/, replace: "$&,$self.renderRememberButton(this.state)" } }, { - find: /statusPickerModalMenu,"aria-label":.{0,1}\..{0,50}\)/, + find: '"aria-label":#{intl::STATUS_MENU_LABEL}', replacement: { match: /!\i&&(.{0,15}\i\.Fragment.{0,55}null==(\i).{0,200}customEmojiPlaceholder\}\),onClick:([^}]+}))/, replace: "$self.render($2, $3),false&&$1" diff --git a/src/equicordplugins/whitelistedEmojis/index.tsx b/src/equicordplugins/whitelistedEmojis/index.tsx index 75d489da7..8c97de459 100644 --- a/src/equicordplugins/whitelistedEmojis/index.tsx +++ b/src/equicordplugins/whitelistedEmojis/index.tsx @@ -601,7 +601,7 @@ export default definePlugin({ authors: [EquicordDevs.creations], patches: [ { - find: "null,titleWithoutQuery", + find: "#{intl::EMOJI_MATCHING}", replacement: { match: /renderResults\((\i)\){/, replace: "$&$1.results.emojis=$self.filterEmojis($1);if($1.results.emojis.length===0)return;" diff --git a/src/equicordplugins/youtubeDescription/index.tsx b/src/equicordplugins/youtubeDescription/index.tsx index 59f5b8233..c475eefbe 100644 --- a/src/equicordplugins/youtubeDescription/index.tsx +++ b/src/equicordplugins/youtubeDescription/index.tsx @@ -18,7 +18,7 @@ export default definePlugin({ authors: [Devs.arHSM], patches: [ { - find: "embedSuppressButton,onClick", + find: "#{intl::SUPPRESS_ALL_EMBEDS}", replacement: { match: /case (\i\.\i\.VIDEO):(case \i\.\i\.\i:)*break;default:(\i)=(?:(this\.renderDescription)\(\))\}/, replace: "$2 break; case $1: $3 = $self.ToggleableDescriptionWrapper({ embed: this.props.embed, original: $4.bind(this) }); break; default: $3 = $4() }" From 1952e39f675f268c70b1b18d85a20939ebbe8003 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:13:51 -0500 Subject: [PATCH 10/28] Settings Fix Temp --- src/plugins/_core/settings.tsx | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index e8a4684df..2832abc66 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import { Settings } from "@api/Settings"; import BackupAndRestoreTab from "@components/VencordSettings/BackupAndRestoreTab"; import CloudTab from "@components/VencordSettings/CloudTab"; import PatchHelperTab from "@components/VencordSettings/PatchHelperTab"; @@ -25,7 +24,7 @@ import UpdaterTab from "@components/VencordSettings/UpdaterTab"; import VencordTab from "@components/VencordSettings/VencordTab"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { i18n, React } from "@webpack/common"; +import { React } from "@webpack/common"; import gitHash from "~git-hash"; @@ -148,31 +147,10 @@ export default definePlugin({ ].filter(Boolean); }, - isRightSpot({ header, settings }: { header?: string; settings?: string[]; }) { - const firstChild = settings?.[0]; - // lowest two elements... sanity backup - if (firstChild === "LOGOUT" || firstChild === "SOCIAL_LINKS") return true; - - const { settingsLocation } = Settings.plugins.Settings; - - if (settingsLocation === "bottom") return firstChild === "LOGOUT"; - if (settingsLocation === "belowActivity") return firstChild === "CHANGELOG"; - - if (!header) return; - - const names = { - top: i18n.Messages.USER_SETTINGS, - aboveNitro: i18n.Messages.BILLING_SETTINGS, - belowNitro: i18n.Messages.APP_SETTINGS, - aboveActivity: i18n.Messages.ACTIVITY_SETTINGS - }; - return header === names[settingsLocation]; - }, - patchedSettings: new WeakSet(), addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) { - if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return; + if (this.patchedSettings.has(elements)) return; this.patchedSettings.add(elements); From 3cf79ec436c608de09ea3f47c50f0ff120567d31 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:17:35 -0300 Subject: [PATCH 11/28] Fix most patches --- src/plugins/_api/serverList.ts | 2 +- src/plugins/_core/supportHelper.tsx | 2 +- src/plugins/decor/index.tsx | 2 +- src/plugins/fakeProfileThemes/index.tsx | 2 +- src/plugins/validReply/index.ts | 2 +- src/utils/patches.ts | 14 ++++++++++---- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 38bcfd905..15a1389f9 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -34,7 +34,7 @@ export default definePlugin({ { find: '#{intl::SERVERS}"]),children', replacement: { - match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, + match: /(?<=#{intl::SERVERS}"\]\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" } } diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index f76773b35..6be41d318 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -149,7 +149,7 @@ export default definePlugin({ patches: [{ find: "#{intl::BEGINNING_DM}", replacement: { - match: /#{intl::BEGINNING_DM}"],{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, + match: /#{intl::BEGINNING_DM}"\],{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," } }], diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 69a7a1a59..472079225 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/, + match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}"\]\)},"decoration"\),)/, replace: "$self.DecorSection()," } }, diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index b1cce7251..edc0e7400 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -128,7 +128,7 @@ export default definePlugin({ { find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}", replacement: { - match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, + match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}"\]\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})" } } diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 5e9f8beda..4b62f790d 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -39,7 +39,7 @@ export default definePlugin({ { find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", replacement: { - match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}"]\)/, + match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}"\]\)/, replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" } }, diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 5411ff37d..17c541b66 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -23,11 +23,17 @@ export function canonicalizeMatch(match: T): T { let partialCanon = typeof match === "string" ? match : match.source; partialCanon = partialCanon.replaceAll(/#{intl::([A-Za-z_$][\w$]*)}/g, (_, key) => { const hashed = runtimeHashMessageKey(key); - const isStr = typeof match === "string"; - return /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed) - ? isStr ? `["${hashed}` : String.raw`(?:\["${hashed})` - : isStr ? `.${hashed}` : String.raw`(?:\.${hashed})`; + const isString = typeof match === "string"; + const hasSpecialChars = /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed); + + if (hasSpecialChars) { + return isString + ? `["${hashed}` + : String.raw`(?:\["${hashed})`.replaceAll("+", "\\+"); + } + + return isString ? `.${hashed}` : String.raw`(?:\.${hashed})`; }); if (typeof match === "string") { From e8732303819f028b4b1bd0baf27c13dfe9f3586a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:22:06 -0500 Subject: [PATCH 12/28] HideServers Fix --- src/equicordplugins/hideServers/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equicordplugins/hideServers/index.tsx b/src/equicordplugins/hideServers/index.tsx index 569001637..e1e19a7eb 100644 --- a/src/equicordplugins/hideServers/index.tsx +++ b/src/equicordplugins/hideServers/index.tsx @@ -77,7 +77,7 @@ export default definePlugin({ find: '("guildsnav")', replacement: [ { - match: /(?<=#{intl::SERVERS},children:.{0,300}?)(\i)(\)?\.map\(\i\))/, + match: /(?<=#{intl::SERVERS}"\]\),children:.{0,300}?)(\i)(\)?\.map\(\i\))/, replace: "$self.useFilteredGuilds($1)$2", }, // despite my best efforts, the above doesnt trigger a rerender From 4c642bfcc3414e4e3e04a98b679ef95aabda4164 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:24:43 -0300 Subject: [PATCH 13/28] Fix broken finds --- src/plugins/clientTheme/index.tsx | 2 +- src/plugins/fakeProfileThemes/index.tsx | 4 ++-- .../pinDms/components/CreateCategoryModal.tsx | 2 +- src/plugins/showConnections/VerifiedIcon.tsx | 2 +- .../components/HiddenChannelLockScreen.tsx | 12 +++--------- src/plugins/showTimeoutDuration/index.tsx | 4 +++- src/plugins/userVoiceShow/components.tsx | 2 +- src/webpack/common/components.ts | 2 +- src/webpack/common/utils.ts | 2 +- 9 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/plugins/clientTheme/index.tsx b/src/plugins/clientTheme/index.tsx index 59f3d5fe2..7e6484276 100644 --- a/src/plugins/clientTheme/index.tsx +++ b/src/plugins/clientTheme/index.tsx @@ -14,7 +14,7 @@ import definePlugin, { OptionType, StartAt } from "@utils/types"; import { findByCodeLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { Button, Forms, ThemeStore, useStateFromStores } from "@webpack/common"; -const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); +const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)"); const colorPresets = [ "#1E1514", "#172019", "#13171B", "#1C1C28", "#402D2D", diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index edc0e7400..495d2ddc3 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -108,10 +108,10 @@ interface ProfileModalProps { isTryItOutFlow: boolean; } -const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); +const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)"); const ProfileModal = findComponentByCodeLazy("isTryItOutFlow:", "pendingThemeColors:", "pendingAvatarDecoration:", "EDIT_PROFILE_BANNER"); -const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/); +const requireColorPicker = extractAndLoadChunksLazy(["#{intl::USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON}"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/); export default definePlugin({ name: "FakeProfileThemes", diff --git a/src/plugins/pinDms/components/CreateCategoryModal.tsx b/src/plugins/pinDms/components/CreateCategoryModal.tsx index 2f1d4d1d5..7c4cf0d07 100644 --- a/src/plugins/pinDms/components/CreateCategoryModal.tsx +++ b/src/plugins/pinDms/components/CreateCategoryModal.tsx @@ -30,7 +30,7 @@ interface ColorPickerWithSwatchesProps { renderCustomButton?: () => React.ReactNode; } -const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); +const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)"); const ColorPickerWithSwatches = findExportedComponentLazy("ColorPicker", "CustomColorPicker"); export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}Promise\.all\((\[\i\.\i\("?.+?"?\).+?\])\).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/); diff --git a/src/plugins/showConnections/VerifiedIcon.tsx b/src/plugins/showConnections/VerifiedIcon.tsx index ffdf21e63..d4d3f094a 100644 --- a/src/plugins/showConnections/VerifiedIcon.tsx +++ b/src/plugins/showConnections/VerifiedIcon.tsx @@ -20,7 +20,7 @@ import { findComponentByCodeLazy, findLazy } from "@webpack"; import { i18n, useToken } from "@webpack/common"; const ColorMap = findLazy(m => m.colors?.INTERACTIVE_MUTED?.css); -const VerifiedIconComponent = findComponentByCodeLazy(".CONNECTIONS_ROLE_OFFICIAL_ICON_TOOLTIP"); +const VerifiedIconComponent = findComponentByCodeLazy("#{intl::CONNECTIONS_ROLE_OFFICIAL_ICON_TOOLTIP}"); export function VerifiedIcon() { const color = useToken(ColorMap.colors.INTERACTIVE_MUTED).hex(); diff --git a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx index bdb9fee8c..51c984b08 100644 --- a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx +++ b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx @@ -19,7 +19,7 @@ import { Settings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { formatDuration } from "@utils/text"; -import { findByPropsLazy, findComponentByCodeLazy, findComponentLazy } from "@webpack"; +import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import { EmojiStore, FluxDispatcher, GuildMemberStore, GuildStore, Parser, PermissionsBits, PermissionStore, SnowflakeUtils, Text, Timestamp, Tooltip, useEffect, useState } from "@webpack/common"; import type { Channel } from "discord-types/general"; @@ -80,14 +80,8 @@ const enum ChannelFlags { const ChatScrollClasses = findByPropsLazy("auto", "managedReactiveScroller"); const ChatClasses = findByPropsLazy("chat", "content", "noChat", "chatContent"); -const ChannelBeginHeader = findComponentByCodeLazy(".Messages.ROLE_REQUIRED_SINGLE_USER_MESSAGE"); -const TagComponent = findComponentLazy(m => { - if (typeof m !== "function") return false; - - const code = Function.prototype.toString.call(m); - // Get the component which doesn't include increasedActivity - return code.includes(".Messages.FORUM_TAG_A11Y_FILTER_BY_TAG") && !code.includes("increasedActivityPill"); -}); +const ChannelBeginHeader = findComponentByCodeLazy("#{intl::ROLE_REQUIRED_SINGLE_USER_MESSAGE}"); +const TagComponent = findComponentByCodeLazy("#{intl::FORUM_TAG_A11Y_FILTER_BY_TAG}"); const EmojiParser = findByPropsLazy("convertSurrogateToName"); const EmojiUtils = findByPropsLazy("getURL", "getEmojiColors"); diff --git a/src/plugins/showTimeoutDuration/index.tsx b/src/plugins/showTimeoutDuration/index.tsx index c0f5e918b..6f00f4c74 100644 --- a/src/plugins/showTimeoutDuration/index.tsx +++ b/src/plugins/showTimeoutDuration/index.tsx @@ -9,13 +9,15 @@ import "./styles.css"; import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; +import { canonicalizeMatch } from "@utils/patches"; import definePlugin, { OptionType } from "@utils/types"; import { findComponentLazy } from "@webpack"; import { ChannelStore, GuildMemberStore, i18n, Text, Tooltip } from "@webpack/common"; import { Message } from "discord-types/general"; import { FunctionComponent, ReactNode } from "react"; -const CountDown = findComponentLazy(m => m.prototype?.render?.toString().includes(".MAX_AGE_NEVER")); +const countDownFilter = canonicalizeMatch("#{intl::MAX_AGE_NEVER}"); +const CountDown = findComponentLazy(m => m.prototype?.render?.toString().includes(countDownFilter)); const enum DisplayStyle { Tooltip = "tooltip", diff --git a/src/plugins/userVoiceShow/components.tsx b/src/plugins/userVoiceShow/components.tsx index 7a6f4dd2a..e8924f829 100644 --- a/src/plugins/userVoiceShow/components.tsx +++ b/src/plugins/userVoiceShow/components.tsx @@ -14,7 +14,7 @@ import { Channel } from "discord-types/general"; const cl = classNameFactory("vc-uvs-"); const { selectVoiceChannel } = findByPropsLazy("selectVoiceChannel", "selectChannel"); -const { useChannelName } = mapMangledModuleLazy(".Messages.GROUP_DM_ALONE", { +const { useChannelName } = mapMangledModuleLazy("#{intl::GROUP_DM_ALONE}", { useChannelName: filters.byCode("()=>null==") }); const getDMChannelIcon = findByCodeLazy(".getChannelIconURL({"); diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 0bcb82d1b..11526c0f3 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -56,7 +56,7 @@ export let FocusLock: t.FocusLock; export let useToken: t.useToken; export const MaskedLink = waitForComponent("MaskedLink", filters.componentByCode("MASKED_LINK)")); -export const Timestamp = waitForComponent("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format")); +export const Timestamp = waitForComponent("Timestamp", filters.byCode("#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}")); export const Flex = waitForComponent("Flex", ["Justify", "Align", "Wrap"]); export const { OAuth2AuthorizeModal } = findByPropsLazy("OAuth2AuthorizeModal"); diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts index 2d0026b58..2bce1db7a 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -131,7 +131,7 @@ export const UserUtils = { export const UploadManager = findByPropsLazy("clearAll", "addFile"); export const UploadHandler = { - promptToUpload: findByCodeLazy(".ATTACHMENT_TOO_MANY_ERROR_TITLE,") as (files: File[], channel: Channel, draftType: Number) => void + promptToUpload: findByCodeLazy("#{intl::ATTACHMENT_TOO_MANY_ERROR_TITLE}") as (files: File[], channel: Channel, draftType: Number) => void }; export const ApplicationAssetUtils = findByPropsLazy("fetchAssetIds", "getAssetImage") as { From 907bc25eef573565b135aae7e52cb2f95049926c Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:26:39 -0300 Subject: [PATCH 14/28] Temp fix for settings --- src/plugins/_core/settings.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 939cf83a6..e9eaa71ba 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -26,7 +26,7 @@ import UpdaterTab from "@components/VencordSettings/UpdaterTab"; import VencordTab from "@components/VencordSettings/VencordTab"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { i18n, React } from "@webpack/common"; +import { React } from "@webpack/common"; import gitHash from "~git-hash"; @@ -148,13 +148,13 @@ export default definePlugin({ if (!header) return; - const names = { + /* const names = { top: i18n.Messages.USER_SETTINGS, aboveNitro: i18n.Messages.BILLING_SETTINGS, belowNitro: i18n.Messages.APP_SETTINGS, aboveActivity: i18n.Messages.ACTIVITY_SETTINGS }; - return header === names[settingsLocation]; + return header === names[settingsLocation]; */ }, patchedSettings: new WeakSet(), From a1487b50bebaa27cc4bfa125c0c81d0cb3a2f04d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:00:08 -0300 Subject: [PATCH 15/28] Fix settings properly --- src/plugins/_core/settings.tsx | 13 +++++++------ src/utils/discord.tsx | 21 ++++++++++++++++++++- src/webpack/common/types/i18nMessages.ts | 24 ------------------------ src/webpack/common/types/index.d.ts | 1 - src/webpack/common/types/utils.d.ts | 14 -------------- src/webpack/common/utils.ts | 6 +++++- 6 files changed, 32 insertions(+), 47 deletions(-) delete mode 100644 src/webpack/common/types/i18nMessages.ts diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index e9eaa71ba..cde3e9e63 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -25,6 +25,7 @@ import ThemesTab from "@components/VencordSettings/ThemesTab"; import UpdaterTab from "@components/VencordSettings/UpdaterTab"; import VencordTab from "@components/VencordSettings/VencordTab"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { React } from "@webpack/common"; @@ -148,13 +149,13 @@ export default definePlugin({ if (!header) return; - /* const names = { - top: i18n.Messages.USER_SETTINGS, - aboveNitro: i18n.Messages.BILLING_SETTINGS, - belowNitro: i18n.Messages.APP_SETTINGS, - aboveActivity: i18n.Messages.ACTIVITY_SETTINGS + const names = { + top: getIntlMessage("USER_SETTINGS"), + aboveNitro: getIntlMessage("BILLING_SETTINGS"), + belowNitro: getIntlMessage("APP_SETTINGS"), + aboveActivity: getIntlMessage("ACTIVITY_SETTINGS") }; - return header === names[settingsLocation]; */ + return header === names[settingsLocation]; }, patchedSettings: new WeakSet(), diff --git a/src/utils/discord.tsx b/src/utils/discord.tsx index fed5a5d86..c79bbc39b 100644 --- a/src/utils/discord.tsx +++ b/src/utils/discord.tsx @@ -19,12 +19,31 @@ import "./discord.css"; import { MessageObject } from "@api/MessageEvents"; -import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, InviteActions, MessageActions, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common"; +import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, i18n, InviteActions, MessageActions, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common"; import { Channel, Guild, Message, User } from "discord-types/general"; import { Except } from "type-fest"; +import { runtimeHashMessageKey } from "./intlHash"; import { MediaModalItem, MediaModalProps, openMediaModal } from "./modal"; +/** + * Get an internationalized message from a non hashed key + * @param key The plain message key + * @param values The values to interpolate, if it's a rich message + */ +export function getIntlMessage(key: string, values?: Record): string { + return getIntlMessageFromHash(runtimeHashMessageKey(key), values); +} + +/** + * Get an internationalized message from a hashed key + * @param key The hashed message key + * @param values The values to interpolate, if it's a rich message + */ +export function getIntlMessageFromHash(key: string, values?: Record): string { + return values == null ? i18n.intl.string(i18n.t[key]) : i18n.intl.format(i18n.t[key], values); +} + /** * Open the invite modal * @param code The invite code diff --git a/src/webpack/common/types/i18nMessages.ts b/src/webpack/common/types/i18nMessages.ts deleted file mode 100644 index fdf677fc0..000000000 --- a/src/webpack/common/types/i18nMessages.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { LiteralUnion } from "type-fest"; - -export type i18nMessages = LiteralUnion< - "TITLE_BAR_CLOSE_WINDOW" | "TITLE_BAR_MAXIMIZE_WINDOW" | "TITLE_BAR_MINIMIZE_WINDOW" | "en-US" | "en-GB" | "zh-CN" | "zh-TW" | "cs" | "da" | "nl" | "fr" | "de" | "el" | "hu" | "it" | "ja" | "ko" | "pl" | "pt-BR" | "ru" | "es-ES" | "sv-SE" | "tr" | "bg" | "uk" | "fi" | "no" | "hr" | "ro" | "lt" | "th" | "vi" | "hi" | "KEYBIND_DESCRIPTION_MODAL_NAVIGATE_SERVERS" | "KEYBIND_DESCRIPTION_MODAL_NAVIGATE_CHANNELS" | "KEYBIND_DESCRIPTION_MODAL_NAVIGATE_BACK_FORWARD" | "KEYBIND_DESCRIPTION_MODAL_UNREAD_CHANNELS" | "KEYBIND_DESCRIPTION_MODAL_UNREAD_MENTION_CHANNELS" | "KEYBIND_DESCRIPTION_MODAL_NAVIGATE_TO_CALL" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_PREVIOUS_GUILD" | "KEYBIND_DESCRIPTION_MODAL_QUICKSWITCHER" | "KEYBIND_DESCRIPTION_MODAL_CREATE_GUILD" | "DND_OPERATION_LABEL_START" | "DND_OPERATION_LABEL_MOVE" | "DND_OPERATION_LABEL_DROP" | "DND_OPERATION_LABEL_CANCEL" | "KEYBIND_DESCRIPTION_MODAL_MARK_SERVER_READ" | "KEYBIND_DESCRIPTION_MODAL_MARK_CHANNEL_READ" | "KEYBIND_DESCRIPTION_MODAL_CREATE_DM_GROUP" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_PINS" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_INBOX" | "KEYBIND_DESCRIPTION_MODAL_MARK_TOP_INBOX_CHANNEL_READ" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_USERS" | "KEYBIND_DESCRIPTION_MODAL_SEARCH_EMOJIS" | "KEYBIND_DESCRIPTION_MODAL_SEARCH_GIFS" | "KEYBIND_DESCRIPTION_MODAL_SEARCH_STICKERS" | "KEYBIND_DESCRIPTION_MODAL_SCROLL_CHAT" | "KEYBIND_DESCRIPTION_MODAL_JUMP_TO_FIRST_UNREAD" | "KEYBIND_DESCRIPTION_MODAL_FOCUS_TEXT_AREA" | "KEYBIND_DESCRIPTION_MODAL_UPLOAD_FILE" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_MUTE" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_DEAFEN" | "KEYBIND_DESCRIPTION_MODAL_CALL_ACCEPT" | "KEYBIND_DESCRIPTION_MODAL_CALL_DECLINE" | "KEYBIND_DESCRIPTION_MODAL_CALL_START" | "KEYBIND_DESCRIPTION_MODAL_TOGGLE_HELP" | "KEYBIND_DESCRIPTION_MODAL_SEARCH" | "KEYBIND_DESCRIPTION_MODAL_EASTER_EGG" | "EDIT_MESSAGE" | "DELETE_MESSAGE" | "PIN_MESSAGE" | "ADD_REACTION" | "MESSAGE_ACTION_REPLY" | "COPY_TEXT" | "MARK_UNREAD" | "GUILDS_BAR_A11Y_LABEL" | "SERVERS" | "NEW" | "ADD_A_SERVER" | "GUILD_DISCOVERY_TOOLTIP" | "ACCOUNT_A11Y_LABEL" | "GUILD_SIDEBAR_A11Y_LABEL" | "UNKNOWN_USER" | "LOADING" | "LOADING_DID_YOU_KNOW" | "CONNECTING_PROBLEMS_CTA" | "TWEET_US" | "SERVER_STATUS" | "NOTIFICATION_CENTER_INCOMING_FRIEND_REQUEST" | "COMMAND_SHRUG_MESSAGE_DESCRIPTION" | "DIRECT_MESSAGES" | "GUILD_TOOLTIP_A11Y_LABEL" | "FAVORITES_GUILD_NAME" | "MEMBER_VERIFICATION_FOLDER_NAME" | "DND_DROP_ABOVE" | "DND_DROP_COMBINE" | "GUILD_FOLDER_TOOLTIP_A11Y_LABEL" | "DND_END_OF_LIST" | "GUILD_SIDEBAR_ACTIONS_BUTTON" | "PREMIUM_GUILD_TIER_3" | "PREMIUM_GUILD_SUBSCRIPTION_SUBSCRIBER_COUNT_TOOLTIP" | "CHANNELS" | "NEW_UNREADS" | "NEW_MENTIONS" | "UNMUTE" | "MUTE" | "DEAFEN" | "SET_STATUS" | "LABEL_WITH_ONLINE_STATUS" | "STATUS_ONLINE" | "USER_SETTINGS" | "CHANNEL_HEADER_BAR_A11Y_LABEL" | "TEXT_CHANNEL" | "UPLOAD_TO" | "UPLOAD_AREA_HELP" | "THREADS" | "NOTIFICATION_SETTINGS" | "PINNED_MESSAGES" | "MEMBER_LIST_SHOWN" | "SEARCH" | "SEARCH_CLEAR" | "INBOX" | "HELP" | "TEXTAREA_PLACEHOLDER" | "TEXTAREA_TEXT_CHANNEL_A11Y_LABEL" | "CHANNEL_A11Y_LABEL" | "CHANNEL_CHAT_HEADING" | "CHANNEL_MESSAGES_A11Y_LABEL" | "CHANNEL_MESSAGES_A11Y_DESCRIPTION" | "CHAT_ATTACH_UPLOAD_A_FILE" | "CHAT_ATTACH_UPLOAD_TEXT_AS_FILE" | "CREATE_THREAD" | "CHAT_ATTACH_USE_SLASH_COMMAND" | "CHAT_ATTACH_UPLOAD_OR_INVITE" | "PREMIUM_GIFT_BUTTON_TOOLTIP" | "PREMIUM_GIFT_BUTTON_LABEL" | "GIF_BUTTON_LABEL" | "STICKER_BUTTON_LABEL" | "SELECT_EMOJI" | "CHARACTER_COUNT_CLOSE_TO_LIMIT" | "MEMBERS_LIST_LANDMARK_LABEL" | "MEMBERS" | "PREMIUM_GUILD_SUBSCRIPTIONS_GOAL" | "PREMIUM_GUILD_TIER_3_SHORT" | "PREMIUM_GUILD_SUBSCRIPTIONS_PROGRESS_BAR_BLURB" | "PREMIUM_GUILD_SUBSCRIPTIONS_PROGRESS_BAR_COMPLETED_BLURB" | "PREMIUM_GUILD_SUBSCRIPTIONS_NUDGE_TOOLTIP_COMPLETE" | "PREMIUM_GUILD_SUBSCRIPTIONS_PROGRESS_BAR_TADA_ICON_ALT_TEXT" | "GUILD_EVENTS" | "GUILD_SIDEBAR_DEFAULT_CHANNEL_A11Y_LABEL" | "CHANNEL_TOOLTIP_TEXT_LIMITED" | "CREATE_INSTANT_INVITE" | "EDIT_CHANNEL" | "CHANNEL_TOOLTIP_TEXT" | "CATEGORY_A11Y_LABEL" | "CREATE_CHANNEL" | "CHANNEL_TOOLTIP_RULES" | "GUILD_SIDEBAR_ANNOUNCEMENT_CHANNEL_A11Y_LABEL" | "CHANNEL_TOOLTIP_ANNOUNCEMENTS" | "GUILD_SIDEBAR_STAGE_CHANNEL_A11Y_LABEL" | "OPEN_CHAT" | "CHANNEL_TOOLTIP_STAGE_LIMITED" | "CHANNEL_TOOLTIP_TEXT_ACTIVE_THREADS" | "THREAD_GROUP_A11Y_LABEL" | "GUILD_SIDEBAR_THREAD_A11Y_LABEL" | "GUILD_SIDEBAR_VOICE_CHANNEL_A11Y_LABEL" | "GUILD_SIDEBAR_CHANNEL_A11Y_LABEL_UNREAD" | "GUILD_SIDEBAR_VOICE_CHANNEL_A11Y_LABEL_USERS" | "CHANNEL_TOOLTIP_VOICE" | "STATUS_UNKNOWN" | "MESSAGE_A11Y_ROLE_DESCRIPTION" | "ROLE_ICON_ALT_TEXT" | "CHANNEL_MESSAGE_REPLY_A11Y_LABEL" | "IMAGE" | "MESSAGE_EDITED" | "MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL" | "EMOJI_TOOLTIP_CLICK_CTA" | "REMOVE_MESSAGE_ATTACHMENT" | "VERIFIED_BOT_TOOLTIP" | "SUPPRESS_ALL_EMBEDS" | "CHANNEL_MEMBERS_A11Y_LABEL" | "GUILD_OWNER" | "PREMIUM_GUILD_SUBSCRIPTION_TOOLTIP" | "STATUS_ONLINE_MOBILE" | "STATUS_IDLE" | "STREAMING" | "LISTENING_TO" | "WATCHING" | "COMPETING" | "PLAYING_GAME" | "STATUS_DND" | "CHAT_ATTACH_INVITE_TO_LISTEN" | "ACTIVITY_PANEL_GO_LIVE_STREAM_GAME" | "SEARCH_ANSWER_HAS_LINK" | "SEARCH_ANSWER_HAS_EMBED" | "SEARCH_ANSWER_HAS_ATTACHMENT" | "SEARCH_ANSWER_HAS_VIDEO" | "SEARCH_ANSWER_HAS_IMAGE" | "SEARCH_ANSWER_HAS_SOUND" | "SEARCH_ANSWER_HAS_STICKER" | "SEARCH_FILTER_FROM" | "SEARCH_FILTER_MENTIONS" | "SEARCH_FILTER_HAS" | "SEARCH_FILTER_FILE_TYPE" | "SEARCH_FILTER_FILE_NAME" | "SEARCH_FILTER_BEFORE" | "SEARCH_FILTER_ON" | "SEARCH_FILTER_DURING" | "SEARCH_FILTER_AFTER" | "SEARCH_FILTER_IN" | "SEARCH_FILTER_PINNED" | "MESSAGE_UTILITIES_A11Y_LABEL" | "EDIT" | "MORE" | "SEARCH_SHORTCUT_TODAY" | "SEARCH_SHORTCUT_YESTERDAY" | "SEARCH_SHORTCUT_WEEK" | "SEARCH_SHORTCUT_MONTH" | "SEARCH_SHORTCUT_YEAR" | "SEARCH_GROUP_HEADER_SEARCH_OPTIONS" | "SEARCH_GROUP_HEADER_HISTORY" | "LEARN_MORE" | "SEARCH_ANSWER_FROM" | "SEARCH_ANSWER_MENTIONS" | "SEARCH_ANSWER_HAS" | "SEARCH_ANSWER_DATE" | "SEARCH_ANSWER_IN" | "SEARCH_ANSWER_BOOLEAN" | "SEARCH_CLEAR_HISTORY" | "SEARCH_FROM_SUGGESTIONS" | "MEMBER_LIST_HIDDEN" | "SEARCH_RESULTS_SECTION_LABEL" | "SEARCH_NEWEST_SHORT" | "SEARCH_OLDEST_SHORT" | "SEARCH_MOST_RELEVANT_SHORT" | "SEARCHING" | "TOTAL_RESULTS" | "JUMP" | "REPLY_QUOTE_MESSAGE_NOT_LOADED" | "COPY_MESSAGE_LINK" | "COPY_ID" | "MESSAGE_ACTIONS_MENU_LABEL" | "ACTIVE_THREADS_POPOUT_HEADER" | "ACTIVE_THREADS_POPOUT_LINK" | "THREAD_BROWSER_TIMESTAMP_MINUTES" | "THREAD_BROWSER_TIMESTAMP_HOURS" | "THREAD_BROWSER_TIMESTAMP_DAYS" | "THREAD_BROWSER_TIMESTAMP_MORE_THAN_MONTH" | "OPEN_CHANNEL_TOPIC" | "VIDEO" | "REPLY_QUOTE_NO_TEXT_CONTENT" | "PLAY" | "NEW_MEMBER_BADGE_TOOLTIP_TEXT" | "USER_SETTINGS_MY_ACCOUNT" | "USER_SETTINGS_PROFILES" | "PRIVACY_AND_SAFETY" | "AUTHORIZED_APPS" | "AUTH_SESSIONS" | "CONNECTIONS" | "CLIPS" | "FRIEND_REQUESTS" | "BILLING_SETTINGS" | "PREMIUM" | "PREMIUM_GUILD_SUBSCRIPTION_TITLE" | "SUBSCRIPTIONS_TITLE" | "GIFT_INVENTORY" | "BILLING" | "APP_SETTINGS" | "APPEARANCE" | "ACCESSIBILITY" | "VOICE_AND_VIDEO" | "POGGERMODE" | "TEXT_AND_IMAGES" | "NOTIFICATIONS" | "KEYBINDS" | "LANGUAGE" | "USER_SETTINGS_WINDOWS_SETTINGS" | "USER_SETTINGS_LINUX_SETTINGS" | "STREAMER_MODE" | "SETTINGS_ADVANCED" | "ACTIVITY_SETTINGS" | "ACTIVITY_PRIVACY" | "REGISTERED_GAMES" | "OVERLAY" | "WHATS_NEW" | "USER_SETTINGS_HYPESQUAD" | "LOGOUT" | "BETA" | "USER_SETTINGS_ACCOUNT_PASSWORD_AND_AUTHENTICATION" | "CHANGE_PASSWORD" | "USER_SETTINGS_EDIT_USER_PROFILE" | "ACTIONS" | "HYPESQUAD_ONLINE_BADGE_TOOLTIP" | "HYPESQUAD_HOUSE_1" | "ACTIVE_DEVELOPER_BADGE_TOOLTIP" | "PROFILE_USER_BADGES" | "USER_SETTINGS_LABEL_USERNAME" | "USER_SETTINGS_ACCOUNT_EDIT_USERNAME_A11Y_LABEL" | "USER_SETTINGS_ACCOUNT_EDIT_EMAIL_A11Y_LABEL" | "USER_SETTINGS_ACCOUNT_REVEAL_EMAIL_A11Y_LABEL" | "USER_SETTINGS_ACCOUNT_HIDE_EMAIL_A11Y_LABEL" | "USER_SETTINGS_LABEL_EMAIL" | "REVEAL" | "USER_SETTINGS_ACCOUNT_REVEAL_PHONE_A11Y_LABEL" | "USER_SETTINGS_ACCOUNT_HIDE_PHONE_A11Y_LABEL" | "USER_SETTINGS_LABEL_PHONE_NUMBER" | "USER_SETTINGS_ACCOUNT_REMOVE_PHONE_A11Y_LABEL" | "REMOVE" | "USER_SETTINGS_ACCOUNT_EDIT_PHONE_A11Y_LABEL" | "TWO_FA_VIEW_BACKUP_CODES" | "TWO_FA_ENABLED" | "TWO_FA_DESCRIPTION" | "TWO_FA_DISABLED_FOR_SERVER_SUBSCRIPTION_MOD" | "MFA_SMS_AUTH_CURRENT_PHONE" | "MFA_SMS_PHONE_NUMBER_REVEAL" | "MFA_SMS_ENABLE" | "CHANGE_PHONE_NUMBER" | "MFA_SMS_AUTH" | "MFA_SMS_AUTH_SALES_PITCH" | "TWO_FA_REMOVE" | "USER_SETTINGS_ACCOUNT_REMOVAL_SECTION" | "USER_SETTINGS_ACCOUNT_REMOVAL_DESCRIPTION" | "DISABLE_ACCOUNT" | "DELETE_ACCOUNT" | "CLOSE" | "PREMIUM_BADGE_TOOLTIP" | "SELECT" | "REPLYING_TO" | "SUPER_REACTION_NITRO_TOOLTIP" | "YOURE_VIEWING_OLDER_MESSAGES" | "JUMP_TO_PRESENT" | "REACT_WITH_COUNT_A11Y_LABEL" | "SEARCH_NO_RESULTS" | "GUILD_SIDEBAR_CHANNEL_A11Y_LABEL_LIMIT" | "COPY_LINK" | "DELETE" | "GUILD_SIDEBAR_DEFAULT_CHANNEL_A11Y_LABEL_WITH_MENTIONS" | "NEW_MESSAGES" | "NEW_MESSAGES_PILL" | "JUMP_TO_LAST_UNREAD_MESSAGE" | "MARK_AS_READ", - string ->; diff --git a/src/webpack/common/types/index.d.ts b/src/webpack/common/types/index.d.ts index a536cdcf1..77148dd0b 100644 --- a/src/webpack/common/types/index.d.ts +++ b/src/webpack/common/types/index.d.ts @@ -19,7 +19,6 @@ export * from "./classes"; export * from "./components"; export * from "./fluxEvents"; -export * from "./i18nMessages"; export * from "./menu"; export * from "./stores"; export * from "./utils"; diff --git a/src/webpack/common/types/utils.d.ts b/src/webpack/common/types/utils.d.ts index c0a930049..00e3f4a0b 100644 --- a/src/webpack/common/types/utils.d.ts +++ b/src/webpack/common/types/utils.d.ts @@ -21,7 +21,6 @@ import type { ReactNode } from "react"; import { LiteralUnion } from "type-fest"; import type { FluxEvents } from "./fluxEvents"; -import { i18nMessages } from "./i18nMessages"; export { FluxEvents }; @@ -148,19 +147,6 @@ export interface LocaleInfo { postgresLang: string; } -export interface i18n { - getAvailableLocales(): Locale[]; - getLanguages(): LocaleInfo[]; - getDefaultLocale(): string; - getLocale(): string; - getLocaleInfo(): LocaleInfo; - setLocale(locale: string): void; - - loadPromise: Promise; - - Messages: Record; -} - export interface Clipboard { copy(text: string): void; SUPPORTS_COPY: boolean; diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts index 2bce1db7a..3f44d106d 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import { runtimeHashMessageKey } from "@utils/intlHash"; import type { Channel } from "discord-types/general"; // eslint-disable-next-line path-alias/no-relative @@ -56,7 +57,10 @@ export const { match, P }: Pick = ma export const lodash: typeof import("lodash") = findByPropsLazy("debounce", "cloneDeep"); -export const i18n: t.i18n = findLazy(m => m.Messages?.["en-US"]); +export const i18n = mapMangledModuleLazy('defaultLocale:"en-US"', { + intl: filters.byProps("string", "format"), + t: filters.byProps(runtimeHashMessageKey("DISCORD")) +}); export let SnowflakeUtils: t.SnowflakeUtils; waitFor(["fromTimestamp", "extractTimestamp"], m => SnowflakeUtils = m); From 80ae0603577599b99dc80c7683854e2e872bf142 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:07:46 -0300 Subject: [PATCH 16/28] Fix i18n usage --- src/components/Icons.tsx | 5 ++--- src/debug/loadLazyChunks.ts | 4 +--- src/plugins/betterFolders/index.tsx | 5 +++-- src/plugins/betterSettings/PluginsSubmenu.tsx | 5 +++-- src/plugins/betterSettings/index.tsx | 5 +++-- .../decor/ui/components/DecorationGridCreate.tsx | 5 +++-- .../decor/ui/components/DecorationGridNone.tsx | 5 +++-- src/plugins/fullSearchContext/index.tsx | 7 ++++--- src/plugins/messageLogger/index.tsx | 5 +++-- src/plugins/pauseInvitesForever/index.tsx | 5 +++-- .../components/RolesAndUsersPermissions.tsx | 10 +++++----- .../components/UserPermissions.tsx | 5 +++-- src/plugins/permissionsViewer/utils.ts | 7 ++++--- src/plugins/showConnections/VerifiedIcon.tsx | 5 +++-- src/plugins/showTimeoutDuration/index.tsx | 10 ++++++++-- src/plugins/typingIndicator/index.tsx | 13 ++++++++----- .../userMessagesPronouns/PronounsChatComponent.tsx | 5 +++-- src/plugins/userVoiceShow/index.tsx | 2 +- src/plugins/viewRaw/index.tsx | 5 +++-- src/utils/discord.tsx | 4 ++-- 20 files changed, 68 insertions(+), 49 deletions(-) diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index fa142a18c..d0d2ecbe8 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -18,9 +18,8 @@ import "./iconStyles.css"; -import { getTheme, Theme } from "@utils/discord"; +import { getIntlMessage, getTheme, Theme } from "@utils/discord"; import { classes } from "@utils/misc"; -import { i18n } from "@webpack/common"; import type { PropsWithChildren } from "react"; interface BaseIconProps extends IconProps { @@ -133,7 +132,7 @@ export function InfoIcon(props: IconProps) { export function OwnerCrownIcon(props: IconProps) { return ( (); - // Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before - // the chunk containing the component - const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT"); + const shouldForceDefer = false; await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => { const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : []; diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index 3af5af663..3d04419dd 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -18,9 +18,10 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack"; -import { FluxDispatcher, i18n, useMemo } from "@webpack/common"; +import { FluxDispatcher, useMemo } from "@webpack/common"; import FolderSideBar from "./FolderSideBar"; @@ -276,7 +277,7 @@ export default definePlugin({ makeGuildsBarGuildListFilter(isBetterFolders: boolean) { return child => { if (isBetterFolders) { - return child?.props?.["aria-label"] === i18n.Messages.SERVERS; + return child?.props?.["aria-label"] === getIntlMessage("SERVERS"); } return true; }; diff --git a/src/plugins/betterSettings/PluginsSubmenu.tsx b/src/plugins/betterSettings/PluginsSubmenu.tsx index b22f82a67..ad7ded307 100644 --- a/src/plugins/betterSettings/PluginsSubmenu.tsx +++ b/src/plugins/betterSettings/PluginsSubmenu.tsx @@ -5,8 +5,9 @@ */ import { openPluginModal } from "@components/PluginSettings/PluginModal"; +import { getIntlMessage } from "@utils/discord"; import { isObjectEmpty } from "@utils/misc"; -import { Alerts, i18n, Menu, useMemo, useState } from "@webpack/common"; +import { Alerts, Menu, useMemo, useState } from "@webpack/common"; import Plugins from "~plugins"; @@ -48,7 +49,7 @@ export default function PluginsSubmenu() { query={query} onChange={setQuery} ref={ref} - placeholder={i18n.Messages.SEARCH} + placeholder={getIntlMessage("SEARCH")} /> )} /> diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index 15618faf1..2cee85695 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -7,10 +7,11 @@ import { definePluginSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { waitFor } from "@webpack"; -import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common"; +import { ComponentDispatch, FocusLock, Menu, useEffect, useRef } from "@webpack/common"; import type { HTMLAttributes, ReactElement } from "react"; import PluginsSubmenu from "./PluginsSubmenu"; @@ -159,7 +160,7 @@ export default definePlugin({ if (item.section === "HEADER") { items.push({ label: item.label, items: [] }); } else if (item.section === "DIVIDER") { - items.push({ label: i18n.Messages.OTHER_OPTIONS, items: [] }); + items.push({ label: getIntlMessage("OTHER_OPTIONS"), items: [] }); } else { items.at(-1)!.items.push(item); } diff --git a/src/plugins/decor/ui/components/DecorationGridCreate.tsx b/src/plugins/decor/ui/components/DecorationGridCreate.tsx index 7699b23d9..09572041a 100644 --- a/src/plugins/decor/ui/components/DecorationGridCreate.tsx +++ b/src/plugins/decor/ui/components/DecorationGridCreate.tsx @@ -5,7 +5,8 @@ */ import { PlusIcon } from "@components/Icons"; -import { i18n, Text } from "@webpack/common"; +import { getIntlMessage } from "@utils/discord"; +import { Text } from "@webpack/common"; import { HTMLProps } from "react"; import { DecorationGridItem } from "."; @@ -24,7 +25,7 @@ export default function DecorationGridCreate(props: DecorationGridCreateProps) { variant="text-xs/normal" color="header-primary" > - {i18n.Messages.CREATE} + {getIntlMessage("CREATE")} ; } diff --git a/src/plugins/decor/ui/components/DecorationGridNone.tsx b/src/plugins/decor/ui/components/DecorationGridNone.tsx index b6114c674..81ebde0bd 100644 --- a/src/plugins/decor/ui/components/DecorationGridNone.tsx +++ b/src/plugins/decor/ui/components/DecorationGridNone.tsx @@ -5,7 +5,8 @@ */ import { NoEntrySignIcon } from "@components/Icons"; -import { i18n, Text } from "@webpack/common"; +import { getIntlMessage } from "@utils/discord"; +import { Text } from "@webpack/common"; import { HTMLProps } from "react"; import { DecorationGridItem } from "."; @@ -24,7 +25,7 @@ export default function DecorationGridNone(props: DecorationGridNoneProps) { variant="text-xs/normal" color="header-primary" > - {i18n.Messages.NONE} + {getIntlMessage("NONE")} ; } diff --git a/src/plugins/fullSearchContext/index.tsx b/src/plugins/fullSearchContext/index.tsx index 193e69f1a..3f9e82109 100644 --- a/src/plugins/fullSearchContext/index.tsx +++ b/src/plugins/fullSearchContext/index.tsx @@ -19,10 +19,11 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { migratePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { NoopComponent } from "@utils/react"; import definePlugin from "@utils/types"; import { filters, findByPropsLazy, waitFor } from "@webpack"; -import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common"; +import { ChannelStore, ContextMenuApi, UserStore } from "@webpack/common"; import { Message } from "discord-types/general"; const { useMessageMenu } = findByPropsLazy("useMessageMenu"); @@ -41,7 +42,7 @@ function MessageMenu({ message, channel, onHeightUpdate }) { return useMessageMenu({ navId: "message-actions", - ariaLabel: i18n.Messages.MESSAGE_UTILITIES_A11Y_LABEL, + ariaLabel: getIntlMessage("MESSAGE_UTILITIES_A11Y_LABEL"), message, channel, @@ -72,7 +73,7 @@ const contextMenuPatch: NavContextMenuPatchCallback = (children, props: MessageA const group = findGroupChildrenByChildId("devmode-copy-id", children, true); group?.push( - CopyIdMenuItem({ id: props.message.author.id, label: i18n.Messages.COPY_ID_AUTHOR }) + CopyIdMenuItem({ id: props.message.author.id, label: getIntlMessage("COPY_ID_AUTHOR") }) ); }; diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 080be776b..3ee9f3fad 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -24,12 +24,13 @@ import { Settings } from "@api/Settings"; import { disableStyle, enableStyle } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { proxyLazy } from "@utils/lazy"; import { Logger } from "@utils/Logger"; import { classes } from "@utils/misc"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy, findByPropsLazy } from "@webpack"; -import { ChannelStore, FluxDispatcher, i18n, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common"; +import { ChannelStore, FluxDispatcher, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common"; import { Message } from "discord-types/general"; import overlayStyle from "./deleteStyleOverlay.css?managed"; @@ -178,7 +179,7 @@ export default definePlugin({ isEdited={true} isInline={false} > - {" "}({i18n.Messages.MESSAGE_EDITED}) + {" "}({getIntlMessage("MESSAGE_EDITED")}) ))} diff --git a/src/plugins/pauseInvitesForever/index.tsx b/src/plugins/pauseInvitesForever/index.tsx index ff292a6d2..23b188bcb 100644 --- a/src/plugins/pauseInvitesForever/index.tsx +++ b/src/plugins/pauseInvitesForever/index.tsx @@ -18,8 +18,9 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import definePlugin from "@utils/types"; -import { Constants, GuildStore, i18n, RestAPI } from "@webpack/common"; +import { Constants, GuildStore, RestAPI } from "@webpack/common"; function showDisableInvites(guildId: string) { // @ts-ignore @@ -61,7 +62,7 @@ export default definePlugin({ renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => { return (
- {i18n.Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION} + {getIntlMessage("GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION")} {showDisableInvites(guildId) && { setChecked(true); disableInvites(guildId); diff --git a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx index 82925d610..32dcaf8d6 100644 --- a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx +++ b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx @@ -19,10 +19,10 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { InfoIcon, OwnerCrownIcon } from "@components/Icons"; -import { getUniqueUsername } from "@utils/discord"; +import { getIntlMessage, getUniqueUsername } from "@utils/discord"; import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { findByCodeLazy } from "@webpack"; -import { Clipboard, ContextMenuApi, FluxDispatcher, GuildMemberStore, GuildStore, i18n, Menu, PermissionsBits, ScrollerThin, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common"; +import { Clipboard, ContextMenuApi, FluxDispatcher, GuildMemberStore, GuildStore, Menu, PermissionsBits, ScrollerThin, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common"; import { UnicodeEmoji } from "@webpack/types"; import type { Guild, Role, User } from "discord-types/general"; @@ -216,7 +216,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str > { Clipboard.copy(roleId); }} @@ -225,7 +225,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str {(settings.store as any).unsafeViewAsRole && ( { const role = GuildStore.getRole(guild.id, roleId); if (!role) return; @@ -257,7 +257,7 @@ function UserContextMenu({ userId }: { userId: string; }) { > { Clipboard.copy(userId); }} diff --git a/src/plugins/permissionsViewer/components/UserPermissions.tsx b/src/plugins/permissionsViewer/components/UserPermissions.tsx index 7c0858f10..720445daa 100644 --- a/src/plugins/permissionsViewer/components/UserPermissions.tsx +++ b/src/plugins/permissionsViewer/components/UserPermissions.tsx @@ -18,9 +18,10 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { ExpandableHeader } from "@components/ExpandableHeader"; +import { getIntlMessage } from "@utils/discord"; import { classes } from "@utils/misc"; import { filters, findBulk, proxyLazyWebpack } from "@webpack"; -import { i18n, PermissionsBits, Text, Tooltip, useMemo, UserStore } from "@webpack/common"; +import { PermissionsBits, Text, Tooltip, useMemo, UserStore } from "@webpack/common"; import type { Guild, GuildMember } from "discord-types/general"; import { PermissionsSortOrder, settings } from ".."; @@ -105,7 +106,7 @@ function UserPermissionsComponent({ guild, guildMember, forceOpen = false }: { g permissions: Object.values(PermissionsBits).reduce((prev, curr) => prev | curr, 0n) }); - const OWNER = i18n.Messages.GUILD_OWNER || "Server Owner"; + const OWNER = getIntlMessage("GUILD_OWNER") || "Server Owner"; userPermissions.push({ permission: OWNER, roleName: "Owner", diff --git a/src/plugins/permissionsViewer/utils.ts b/src/plugins/permissionsViewer/utils.ts index ac7537973..b2015840e 100644 --- a/src/plugins/permissionsViewer/utils.ts +++ b/src/plugins/permissionsViewer/utils.ts @@ -17,8 +17,9 @@ */ import { classNameFactory } from "@api/Styles"; +import { getIntlMessage } from "@utils/discord"; import { wordsToTitle } from "@utils/text"; -import { GuildStore, i18n, Parser } from "@webpack/common"; +import { GuildStore, Parser } from "@webpack/common"; import { Guild, GuildMember, Role } from "discord-types/general"; import type { ReactNode } from "react"; @@ -44,7 +45,7 @@ const PermissionKeyMap = { export function getPermissionString(permission: string) { permission = PermissionKeyMap[permission] || permission; - return i18n.Messages[permission] || + return getIntlMessage(permission) || // shouldn't get here but just in case formatPermissionWithoutMatchingString(permission); } @@ -58,7 +59,7 @@ export function getPermissionDescription(permission: string): ReactNode { else if (permission !== "STREAM") permission = PermissionKeyMap[permission] || permission; - const msg = i18n.Messages[`ROLE_PERMISSIONS_${permission}_DESCRIPTION`] as any; + const msg = getIntlMessage(`ROLE_PERMISSIONS_${permission}_DESCRIPTION`) as any; if (msg?.hasMarkdown) return Parser.parse(msg.message); diff --git a/src/plugins/showConnections/VerifiedIcon.tsx b/src/plugins/showConnections/VerifiedIcon.tsx index d4d3f094a..d748f326c 100644 --- a/src/plugins/showConnections/VerifiedIcon.tsx +++ b/src/plugins/showConnections/VerifiedIcon.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ +import { getIntlMessage } from "@utils/discord"; import { findComponentByCodeLazy, findLazy } from "@webpack"; -import { i18n, useToken } from "@webpack/common"; +import { useToken } from "@webpack/common"; const ColorMap = findLazy(m => m.colors?.INTERACTIVE_MUTED?.css); const VerifiedIconComponent = findComponentByCodeLazy("#{intl::CONNECTIONS_ROLE_OFFICIAL_ICON_TOOLTIP}"); @@ -31,7 +32,7 @@ export function VerifiedIcon() { color={color} forcedIconColor={forcedIconColor} size={16} - tooltipText={i18n.Messages.CONNECTION_VERIFIED} + tooltipText={getIntlMessage("CONNECTION_VERIFIED")} /> ); } diff --git a/src/plugins/showTimeoutDuration/index.tsx b/src/plugins/showTimeoutDuration/index.tsx index 6f00f4c74..fa2ef4312 100644 --- a/src/plugins/showTimeoutDuration/index.tsx +++ b/src/plugins/showTimeoutDuration/index.tsx @@ -9,10 +9,11 @@ import "./styles.css"; import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { canonicalizeMatch } from "@utils/patches"; import definePlugin, { OptionType } from "@utils/types"; import { findComponentLazy } from "@webpack"; -import { ChannelStore, GuildMemberStore, i18n, Text, Tooltip } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, Text, Tooltip } from "@webpack/common"; import { Message } from "discord-types/general"; import { FunctionComponent, ReactNode } from "react"; @@ -50,9 +51,14 @@ function renderTimeout(message: Message, inline: boolean) { /> ); + getIntlMessage("GUILD_ENABLE_COMMUNICATION_TIME_REMAINING", { + username: message.author.username, + countdown + }); + return inline ? countdown() - : i18n.Messages.GUILD_ENABLE_COMMUNICATION_TIME_REMAINING.format({ + : getIntlMessage("GUILD_ENABLE_COMMUNICATION_TIME_REMAINING", { username: message.author.username, countdown }); diff --git a/src/plugins/typingIndicator/index.tsx b/src/plugins/typingIndicator/index.tsx index 6df3f4b80..b58d1db72 100644 --- a/src/plugins/typingIndicator/index.tsx +++ b/src/plugins/typingIndicator/index.tsx @@ -21,9 +21,10 @@ import "./style.css"; import { definePluginSettings, Settings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { findComponentByCodeLazy, findExportedComponentLazy, findStoreLazy } from "@webpack"; -import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, RelationshipStore, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common"; import { buildSeveralUsers } from "../typingTweaks"; @@ -72,24 +73,26 @@ function TypingIndicator({ channelId }: { channelId: string; }) { const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers)); let tooltipText: string; + // the new syntax is getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]) }); + switch (typingUsersArray.length) { case 0: break; case 1: { - tooltipText = i18n.Messages.ONE_USER_TYPING.format({ a: getDisplayName(guildId, typingUsersArray[0]) }); + tooltipText = getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]) }); break; } case 2: { - tooltipText = i18n.Messages.TWO_USERS_TYPING.format({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]) }); + tooltipText = getIntlMessage("TWO_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]) }); break; } case 3: { - tooltipText = i18n.Messages.THREE_USERS_TYPING.format({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[2]) }); + tooltipText = getIntlMessage("THREE_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[2]) }); break; } default: { tooltipText = Settings.plugins.TypingTweaks.enabled ? buildSeveralUsers({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), count: typingUsersArray.length - 2 }) - : i18n.Messages.SEVERAL_USERS_TYPING; + : getIntlMessage("SEVERAL_USERS_TYPING"); break; } } diff --git a/src/plugins/userMessagesPronouns/PronounsChatComponent.tsx b/src/plugins/userMessagesPronouns/PronounsChatComponent.tsx index c2d7be2e8..c2a54f14c 100644 --- a/src/plugins/userMessagesPronouns/PronounsChatComponent.tsx +++ b/src/plugins/userMessagesPronouns/PronounsChatComponent.tsx @@ -18,9 +18,10 @@ import { getUserSettingLazy } from "@api/UserSettings"; import ErrorBoundary from "@components/ErrorBoundary"; +import { getIntlMessage } from "@utils/discord"; import { classes } from "@utils/misc"; import { findByPropsLazy } from "@webpack"; -import { i18n, Tooltip, UserStore } from "@webpack/common"; +import { Tooltip, UserStore } from "@webpack/common"; import { Message } from "discord-types/general"; import { settings } from "./settings"; @@ -44,7 +45,7 @@ function PronounsChatComponent({ message }: { message: Message; }) { const pronouns = useFormattedPronouns(message.author.id); return pronouns && ( - + {tooltipProps => ( settings.store.showVoiceChannelIndicator diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx index 83c560df2..0134ea3e3 100644 --- a/src/plugins/viewRaw/index.tsx +++ b/src/plugins/viewRaw/index.tsx @@ -23,11 +23,12 @@ import { CodeBlock } from "@components/CodeBlock"; import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { Margins } from "@utils/margins"; import { copyWithToast } from "@utils/misc"; import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal"; import definePlugin, { OptionType } from "@utils/types"; -import { Button, ChannelStore, Forms, i18n, Menu, Text } from "@webpack/common"; +import { Button, ChannelStore, Forms, Menu, Text } from "@webpack/common"; import { Message } from "discord-types/general"; @@ -122,7 +123,7 @@ function MakeContextCallback(name: "Guild" | "User" | "Channel"): NavContextMenu return (children, props) => { const value = props[name.toLowerCase()]; if (!value) return; - if (props.label === i18n.Messages.CHANNEL_ACTIONS_MENU_LABEL) return; // random shit like notification settings + if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings const lastChild = children.at(-1); if (lastChild?.key === "developer-actions") { diff --git a/src/utils/discord.tsx b/src/utils/discord.tsx index c79bbc39b..ccdb2fb9a 100644 --- a/src/utils/discord.tsx +++ b/src/utils/discord.tsx @@ -31,7 +31,7 @@ import { MediaModalItem, MediaModalProps, openMediaModal } from "./modal"; * @param key The plain message key * @param values The values to interpolate, if it's a rich message */ -export function getIntlMessage(key: string, values?: Record): string { +export function getIntlMessage(key: string, values?: Record): any { return getIntlMessageFromHash(runtimeHashMessageKey(key), values); } @@ -40,7 +40,7 @@ export function getIntlMessage(key: string, values?: Record): * @param key The hashed message key * @param values The values to interpolate, if it's a rich message */ -export function getIntlMessageFromHash(key: string, values?: Record): string { +export function getIntlMessageFromHash(key: string, values?: Record): any { return values == null ? i18n.intl.string(i18n.t[key]) : i18n.intl.format(i18n.t[key], values); } From a514122489367007ae481fd54b409d1e3b0968fe Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:28:28 -0300 Subject: [PATCH 17/28] Fix rest of patches --- src/plugins/consoleShortcuts/index.ts | 2 ++ src/plugins/implicitRelationships/index.ts | 2 +- src/plugins/moreUserTags/index.tsx | 19 ++++++++++--------- src/plugins/typingTweaks/index.tsx | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/plugins/consoleShortcuts/index.ts b/src/plugins/consoleShortcuts/index.ts index 2fdf87356..f10335e3c 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -18,6 +18,7 @@ import { Devs } from "@utils/constants"; import { getCurrentChannel, getCurrentGuild } from "@utils/discord"; +import { runtimeHashMessageKey } from "@utils/intlHash"; import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy"; import { relaunch } from "@utils/native"; import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches"; @@ -104,6 +105,7 @@ function makeShortcuts() { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement, + runtimeHashMessageKey, fakeRender: (component: ComponentType, props: any) => { const prevWin = fakeRenderWin?.deref(); const win = prevWin?.closed === false diff --git a/src/plugins/implicitRelationships/index.ts b/src/plugins/implicitRelationships/index.ts index 868e13550..8960bc130 100644 --- a/src/plugins/implicitRelationships/index.ts +++ b/src/plugins/implicitRelationships/index.ts @@ -50,7 +50,7 @@ export default definePlugin({ { find: "#{intl::FRIENDS_SECTION_ONLINE}", replacement: { - match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.Messages\.BLOCKED\}\)/, + match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.string\(\i\.\i#{intl::BLOCKED}"\]\)\}\)/, replace: "$1.IMPLICIT,className:$2.item,children:\"Implicit\"}),$&" }, }, diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index c6695d313..043c60635 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -19,6 +19,7 @@ import { definePluginSettings } from "@api/Settings"; import { Flex } from "@components/Flex"; import { Devs } from "@utils/constants"; +import { getIntlMessage } from "@utils/discord"; import { Margins } from "@utils/margins"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy, findLazy } from "@webpack"; @@ -191,9 +192,9 @@ export default definePlugin({ replacement: [ // make the tag show the right text { - match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.APP_TAG/, - replace: (_, origSwitch, variant, tags, displayedText, strings) => - `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}], ${strings})}` + match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}#{intl::APP_TAG}"\]\)/, + replace: (_, origSwitch, variant, tags, displayedText) => + `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}])}` }, // show OP tags correctly { @@ -295,19 +296,19 @@ export default definePlugin({ isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]), - getTagText(passedTagName: string, strings: Record) { - if (!passedTagName) return strings.APP_TAG; + getTagText(passedTagName: string) { + if (!passedTagName) return getIntlMessage("APP_TAG"); const [tagName, variant] = passedTagName.split("-"); const tag = tags.find(({ name }) => tagName === name); - if (!tag) return strings.APP_TAG; - if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.APP_TAG; + if (!tag) return getIntlMessage("APP_TAG"); + if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName; switch (variant) { case "OP": - return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER} • ${tagText}`; + return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")} • ${tagText}`; case "BOT": - return `${strings.APP_TAG} • ${tagText}`; + return `${getIntlMessage("APP_TAG")} • ${tagText}`; default: return tagText; } diff --git a/src/plugins/typingTweaks/index.tsx b/src/plugins/typingTweaks/index.tsx index d3f4a1409..4fb3c7757 100644 --- a/src/plugins/typingTweaks/index.tsx +++ b/src/plugins/typingTweaks/index.tsx @@ -112,8 +112,8 @@ export default definePlugin({ { find: "getCooldownTextStyle", replacement: { - match: /(?<=(\i)\.length\?\i.\i\.Messages.THREE_USERS_TYPING\.format\({\i:(\i),(?:\i:)?(\i),\i:\i}\):)\i\.\i\.Messages\.SEVERAL_USERS_TYPING/, - replace: (_, users, a, b) => `$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })` + match: /(,{a:(\i),b:(\i),c:\i}\):)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/, + replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })` }, predicate: () => settings.store.alternativeFormatting } From e038c100422b102dfa396b4abf3220838804ce69 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:31:47 -0300 Subject: [PATCH 18/28] remove trailing newline --- src/utils/intlHash.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/intlHash.ts b/src/utils/intlHash.ts index 069f8f809..e6b77d095 100644 --- a/src/utils/intlHash.ts +++ b/src/utils/intlHash.ts @@ -8,7 +8,6 @@ * @license MIT */ - import { hash as h64 } from "@intrnl/xxhash64"; const BASE64_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); From 17926c9aaccd45391a2b350bd939712c630054f6 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:33:27 -0300 Subject: [PATCH 19/28] annoying error --- src/plugins/implicitRelationships/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/implicitRelationships/index.ts b/src/plugins/implicitRelationships/index.ts index 8960bc130..1f7dbe705 100644 --- a/src/plugins/implicitRelationships/index.ts +++ b/src/plugins/implicitRelationships/index.ts @@ -117,7 +117,7 @@ export default definePlugin({ wrapSort(comparator: Function, row: any) { return row.type === 5 - ? -UserAffinitiesStore.getUserAffinity(row.user.id)?.affinity ?? 0 + ? -(UserAffinitiesStore.getUserAffinity(row.user.id)?.affinity ?? 0) : comparator(row); }, From 321ec844a5bde8b8e1e42e461e0ed18de6cf2f8d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:38:30 -0300 Subject: [PATCH 20/28] it is hiding from me --- src/plugins/betterRoleDot/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/betterRoleDot/index.ts b/src/plugins/betterRoleDot/index.ts index a8cadd8b0..3a8a14567 100644 --- a/src/plugins/betterRoleDot/index.ts +++ b/src/plugins/betterRoleDot/index.ts @@ -47,7 +47,7 @@ export default definePlugin({ }, { - find: ".ADD_ROLE_A11Y_LABEL", + find: "#{intl::ADD_ROLE_A11Y_LABEL}", all: true, predicate: () => Settings.plugins.BetterRoleDot.copyRoleColorInProfilePopout && !Settings.plugins.BetterRoleDot.bothStyles, noWarn: true, From 4cf5b58f9bee080ab4b3d2eacf5520f22d3257cc Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:04:30 -0300 Subject: [PATCH 21/28] re-add try catch --- src/plugins/_core/settings.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 3069c69b3..a94e8cfaf 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -149,13 +149,18 @@ export default definePlugin({ if (!header) return; - const names = { - top: getIntlMessage("USER_SETTINGS"), - aboveNitro: getIntlMessage("BILLING_SETTINGS"), - belowNitro: getIntlMessage("APP_SETTINGS"), - aboveActivity: getIntlMessage("ACTIVITY_SETTINGS") - }; - return header === names[settingsLocation]; + try { + const names = { + top: getIntlMessage("USER_SETTINGS"), + aboveNitro: getIntlMessage("BILLING_SETTINGS"), + belowNitro: getIntlMessage("APP_SETTINGS"), + aboveActivity: getIntlMessage("ACTIVITY_SETTINGS") + }; + + return header === names[settingsLocation]; + } catch { + return firstChild === "PREMIUM"; + } }, patchedSettings: new WeakSet(), From e4aba774e0f930c595fd3da484a1f59bc60f50c4 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:18:33 -0300 Subject: [PATCH 22/28] try catch getIntlMessageFromHash --- src/plugins/betterFolders/index.tsx | 14 ++++++---- src/plugins/moreUserTags/index.tsx | 38 +++++++++++++++------------ src/plugins/typingIndicator/index.tsx | 2 -- src/utils/discord.tsx | 16 ++++++++--- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index 3d04419dd..50dee4f56 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -275,12 +275,16 @@ export default definePlugin({ }, makeGuildsBarGuildListFilter(isBetterFolders: boolean) { - return child => { - if (isBetterFolders) { - return child?.props?.["aria-label"] === getIntlMessage("SERVERS"); - } + try { + return child => { + if (isBetterFolders) { + return child?.props?.["aria-label"] === getIntlMessage("SERVERS"); + } + return true; + }; + } catch { return true; - }; + } }, makeGuildsBarTreeFilter(isBetterFolders: boolean) { diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index 043c60635..db071e724 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -192,9 +192,9 @@ export default definePlugin({ replacement: [ // make the tag show the right text { - match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}#{intl::APP_TAG}"\]\)/, - replace: (_, origSwitch, variant, tags, displayedText) => - `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}])}` + match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=(.{0,40}#{intl::APP_TAG}"\]\))/, + replace: (_, origSwitch, variant, tags, displayedText, originalText) => + `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}],${originalText})}` }, // show OP tags correctly { @@ -296,21 +296,25 @@ export default definePlugin({ isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]), - getTagText(passedTagName: string) { - if (!passedTagName) return getIntlMessage("APP_TAG"); - const [tagName, variant] = passedTagName.split("-"); - const tag = tags.find(({ name }) => tagName === name); - if (!tag) return getIntlMessage("APP_TAG"); - if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); + getTagText(passedTagName: string, originalText: string) { + try { + const [tagName, variant] = passedTagName.split("-"); + if (!passedTagName) return getIntlMessage("APP_TAG"); + const tag = tags.find(({ name }) => tagName === name); + if (!tag) return getIntlMessage("APP_TAG"); + if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); - const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName; - switch (variant) { - case "OP": - return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")} • ${tagText}`; - case "BOT": - return `${getIntlMessage("APP_TAG")} • ${tagText}`; - default: - return tagText; + const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName; + switch (variant) { + case "OP": + return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")} • ${tagText}`; + case "BOT": + return `${getIntlMessage("APP_TAG")} • ${tagText}`; + default: + return tagText; + } + } catch { + return originalText; } }, diff --git a/src/plugins/typingIndicator/index.tsx b/src/plugins/typingIndicator/index.tsx index b58d1db72..e23cf49d2 100644 --- a/src/plugins/typingIndicator/index.tsx +++ b/src/plugins/typingIndicator/index.tsx @@ -73,8 +73,6 @@ function TypingIndicator({ channelId }: { channelId: string; }) { const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers)); let tooltipText: string; - // the new syntax is getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]) }); - switch (typingUsersArray.length) { case 0: break; case 1: { diff --git a/src/utils/discord.tsx b/src/utils/discord.tsx index ccdb2fb9a..91fd791b2 100644 --- a/src/utils/discord.tsx +++ b/src/utils/discord.tsx @@ -24,24 +24,32 @@ import { Channel, Guild, Message, User } from "discord-types/general"; import { Except } from "type-fest"; import { runtimeHashMessageKey } from "./intlHash"; +import { Logger } from "./Logger"; import { MediaModalItem, MediaModalProps, openMediaModal } from "./modal"; +const IntlManagerLogger = new Logger("IntlManager"); + /** * Get an internationalized message from a non hashed key * @param key The plain message key * @param values The values to interpolate, if it's a rich message */ export function getIntlMessage(key: string, values?: Record): any { - return getIntlMessageFromHash(runtimeHashMessageKey(key), values); + return getIntlMessageFromHash(runtimeHashMessageKey(key), values, key); } /** * Get an internationalized message from a hashed key - * @param key The hashed message key + * @param hashedKey The hashed message key * @param values The values to interpolate, if it's a rich message */ -export function getIntlMessageFromHash(key: string, values?: Record): any { - return values == null ? i18n.intl.string(i18n.t[key]) : i18n.intl.format(i18n.t[key], values); +export function getIntlMessageFromHash(hashedKey: string, values?: Record, originalKey?: string): any { + try { + return values == null ? i18n.intl.string(i18n.t[hashedKey]) : i18n.intl.format(i18n.t[hashedKey], values); + } catch (e) { + IntlManagerLogger.error(`Failed to get intl message for key: ${originalKey ?? hashedKey}`, e); + return originalKey ?? ""; + } } /** From 39de683b6eabbc9217ea2b7b77e44d5b952d7f60 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:23:30 -0300 Subject: [PATCH 23/28] better intl transforming --- src/plugins/_api/serverList.ts | 4 ++-- src/plugins/_core/supportHelper.tsx | 2 +- src/plugins/decor/index.tsx | 2 +- src/plugins/fakeProfileThemes/index.tsx | 2 +- src/plugins/implicitRelationships/index.ts | 2 +- src/plugins/moreUserTags/index.tsx | 2 +- src/plugins/validReply/index.ts | 2 +- src/utils/patches.ts | 6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 15a1389f9..dfd40de74 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -32,9 +32,9 @@ export default definePlugin({ } }, { - find: '#{intl::SERVERS}"]),children', + find: "#{intl::SERVERS}),children", replacement: { - match: /(?<=#{intl::SERVERS}"\]\),children:)\i\.map\(\i\)/, + match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" } } diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index 6be41d318..1b9ce162b 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -149,7 +149,7 @@ export default definePlugin({ patches: [{ find: "#{intl::BEGINNING_DM}", replacement: { - match: /#{intl::BEGINNING_DM}"\],{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, + match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," } }], diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 472079225..69a7a1a59 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -41,7 +41,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}"\]\)},"decoration"\),)/, + match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/, replace: "$self.DecorSection()," } }, diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index 495d2ddc3..bfd1cb993 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -128,7 +128,7 @@ export default definePlugin({ { find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}", replacement: { - match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}"\]\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, + match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/, replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})" } } diff --git a/src/plugins/implicitRelationships/index.ts b/src/plugins/implicitRelationships/index.ts index 1f7dbe705..1cde814e7 100644 --- a/src/plugins/implicitRelationships/index.ts +++ b/src/plugins/implicitRelationships/index.ts @@ -50,7 +50,7 @@ export default definePlugin({ { find: "#{intl::FRIENDS_SECTION_ONLINE}", replacement: { - match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.string\(\i\.\i#{intl::BLOCKED}"\]\)\}\)/, + match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.string\(\i\.\i#{intl::BLOCKED}\)\}\)/, replace: "$1.IMPLICIT,className:$2.item,children:\"Implicit\"}),$&" }, }, diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index db071e724..6c9102d81 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -192,7 +192,7 @@ export default definePlugin({ replacement: [ // make the tag show the right text { - match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=(.{0,40}#{intl::APP_TAG}"\]\))/, + match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=(.{0,40}#{intl::APP_TAG}\))/, replace: (_, origSwitch, variant, tags, displayedText, originalText) => `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}],${originalText})}` }, diff --git a/src/plugins/validReply/index.ts b/src/plugins/validReply/index.ts index 4b62f790d..989513d01 100644 --- a/src/plugins/validReply/index.ts +++ b/src/plugins/validReply/index.ts @@ -39,7 +39,7 @@ export default definePlugin({ { find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", replacement: { - match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}"\]\)/, + match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}\)/, replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" } }, diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 17c541b66..e903b2260 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -25,12 +25,12 @@ export function canonicalizeMatch(match: T): T { const hashed = runtimeHashMessageKey(key); const isString = typeof match === "string"; - const hasSpecialChars = /^[\d]/.test(hashed) || !/^[\w$]+$/.test(hashed); + const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+"); if (hasSpecialChars) { return isString - ? `["${hashed}` - : String.raw`(?:\["${hashed})`.replaceAll("+", "\\+"); + ? `["${hashed}"]` + : String.raw`(?:\["${hashed}"\])`.replaceAll("+", "\\+"); } return isString ? `.${hashed}` : String.raw`(?:\.${hashed})`; From b2dc81d144592f5f2a572ff7eb299dd8efb4dc11 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:25:59 -0300 Subject: [PATCH 24/28] fix --- src/utils/patches.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/patches.ts b/src/utils/patches.ts index e903b2260..3812acd91 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -25,7 +25,7 @@ export function canonicalizeMatch(match: T): T { const hashed = runtimeHashMessageKey(key); const isString = typeof match === "string"; - const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+"); + const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/"); if (hasSpecialChars) { return isString From 7dfa1ad5f1376eab110a9a18afc29a6ae6306cc4 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:57:57 -0500 Subject: [PATCH 25/28] Fix Timezones --- src/equicordplugins/timezones/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/equicordplugins/timezones/index.tsx b/src/equicordplugins/timezones/index.tsx index 9dc1ad414..970ed28eb 100644 --- a/src/equicordplugins/timezones/index.tsx +++ b/src/equicordplugins/timezones/index.tsx @@ -14,7 +14,7 @@ import { Devs } from "@utils/constants"; import { openModal } from "@utils/modal"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { i18n, Menu, Tooltip, useEffect, useState } from "@webpack/common"; +import { Menu, Tooltip, useEffect, useState } from "@webpack/common"; import { Message, User } from "discord-types/general"; import { SetTimezoneModal } from "./TimezoneModal"; @@ -27,6 +27,7 @@ export let timezones: Record = {}; })(); const classes = findByPropsLazy("timestamp", "compact", "contentOnly"); +const locale = findByPropsLazy("getLocale"); export const settings = definePluginSettings({ "24h Time": { @@ -50,7 +51,7 @@ export const settings = definePluginSettings({ function getTime(timezone: string, timestamp: string | number, props: Intl.DateTimeFormatOptions = {}) { const date = new Date(timestamp); - const formatter = new Intl.DateTimeFormat(i18n?.getLocale?.() ?? "en-US", { + const formatter = new Intl.DateTimeFormat(locale.getLocale() ?? "en-US", { hour12: !settings.store["24h Time"], timeZone: timezone, ...props From bad5dac776ba3ea62308f92000ab9f86023fff08 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 21:25:19 -0500 Subject: [PATCH 26/28] Fix Broken i18n --- .../ThemeSettings/components/SettingColorComponent.tsx | 2 +- src/equicordplugins/anammox/index.ts | 4 ++-- src/equicordplugins/bannersEverywhere/index.tsx | 2 +- src/equicordplugins/betterBanReasons/index.tsx | 2 +- src/equicordplugins/betterInvites/index.tsx | 2 +- src/equicordplugins/fullUserInChatbox/index.tsx | 2 +- src/equicordplugins/glide/index.tsx | 2 +- src/equicordplugins/hideServers/index.tsx | 2 +- src/equicordplugins/identity/index.tsx | 2 +- src/equicordplugins/loginWithQR/index.tsx | 4 ++-- src/equicordplugins/moreStickers/index.tsx | 4 ++-- src/equicordplugins/noAppsAllowed/index.tsx | 4 ++-- src/equicordplugins/pinIcon/index.tsx | 4 ++-- src/equicordplugins/statusPresets/index.tsx | 4 ++-- src/plugins/_api/serverList.ts | 4 ++-- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/components/ThemeSettings/components/SettingColorComponent.tsx b/src/components/ThemeSettings/components/SettingColorComponent.tsx index 8e0582bab..f8d779f27 100644 --- a/src/components/ThemeSettings/components/SettingColorComponent.tsx +++ b/src/components/ThemeSettings/components/SettingColorComponent.tsx @@ -15,7 +15,7 @@ interface ColorPickerProps { showEyeDropper?: boolean; onChange(value: number | null): void; } -const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); +const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)"); // TinyColor is completely unmangled and it's duplicated in two modules! Fun! const TinyColor: tinycolor.Constructor = findByCodeLazy("this._gradientType="); diff --git a/src/equicordplugins/anammox/index.ts b/src/equicordplugins/anammox/index.ts index 1bf05abb6..e80031cbb 100644 --- a/src/equicordplugins/anammox/index.ts +++ b/src/equicordplugins/anammox/index.ts @@ -77,7 +77,7 @@ export default definePlugin({ find: "#{intl::BILLING_SETTINGS}", replacement: [ { - match: /(?<=#{intl::BILLING_SETTINGS},)/, + match: /(?<=#{intl::BILLING_SETTINGS}\),)/, replace: "capitalism:true," }, { @@ -99,7 +99,7 @@ export default definePlugin({ }, { // Emoji list - find: "#{intl::EMOJI_PICKER_CREATE_EMOJI_TITLE},size:", + find: "#{intl::EMOJI_PICKER_CREATE_EMOJI_TITLE}),size:", replacement: { match: /(\i)=\i\|\|!\i&&\i.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/, replace: "$&$1||" diff --git a/src/equicordplugins/bannersEverywhere/index.tsx b/src/equicordplugins/bannersEverywhere/index.tsx index 88b8ecec0..3badaa031 100644 --- a/src/equicordplugins/bannersEverywhere/index.tsx +++ b/src/equicordplugins/bannersEverywhere/index.tsx @@ -39,7 +39,7 @@ export default definePlugin({ settings, patches: [ { - find: "#{intl::GUILD_OWNER},", + find: "#{intl::GUILD_OWNER}),", replacement: { // We add the banner as a property while we can still access the user id diff --git a/src/equicordplugins/betterBanReasons/index.tsx b/src/equicordplugins/betterBanReasons/index.tsx index dba15cd8e..892d25797 100644 --- a/src/equicordplugins/betterBanReasons/index.tsx +++ b/src/equicordplugins/betterBanReasons/index.tsx @@ -75,7 +75,7 @@ export default definePlugin({ { find: "#{intl::BAN_MULTIPLE_CONFIRM_TITLE}", replacement: [{ - match: /\[\{name:#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}.+?\}\]/, + match: /\[\{name:\i\.\i\.string\(\i\.\i#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}\).+?\}\]/, replace: "$self.getReasons()" }, { diff --git a/src/equicordplugins/betterInvites/index.tsx b/src/equicordplugins/betterInvites/index.tsx index 8a98f95db..c26e21bad 100644 --- a/src/equicordplugins/betterInvites/index.tsx +++ b/src/equicordplugins/betterInvites/index.tsx @@ -40,7 +40,7 @@ export default definePlugin({ find: "#{intl::HUB_INVITE_ANOTHER_SCHOOL_LINK}", replacement: [ { - match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(#{intl::Messages.GUEST_MEMBERSHIP_EXPLANATION})/, + match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(\i\.\i\.string\(\i\.\i#{intl::GUEST_MEMBERSHIP_EXPLANATION}\))/, replace: ",($1||((!$1)&&arguments[0].invite.expires_at)) && $2$self.RenderTip($1, $3, arguments[0].invite.expires_at)" }, { diff --git a/src/equicordplugins/fullUserInChatbox/index.tsx b/src/equicordplugins/fullUserInChatbox/index.tsx index 3b30541c1..b51c488c4 100644 --- a/src/equicordplugins/fullUserInChatbox/index.tsx +++ b/src/equicordplugins/fullUserInChatbox/index.tsx @@ -17,7 +17,7 @@ export default definePlugin({ patches: [ { - find: "#{intl::UNKNOWN_ROLE_PLACEHOLDER}", + find: "#{intl::UNKNOWN_ROLE_PLACEHOLDER})]", replacement: { match: /(hidePersonalInformation.*?)return/, replace: "$1return $self.patchChatboxMention(arguments[0]);" diff --git a/src/equicordplugins/glide/index.tsx b/src/equicordplugins/glide/index.tsx index 8e98b3bc1..6b31fee86 100644 --- a/src/equicordplugins/glide/index.tsx +++ b/src/equicordplugins/glide/index.tsx @@ -88,7 +88,7 @@ function CopyPresetComponent() { ); } -const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); +const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)"); export function generateAndApplyProceduralTheme() { diff --git a/src/equicordplugins/hideServers/index.tsx b/src/equicordplugins/hideServers/index.tsx index e1e19a7eb..789884b5d 100644 --- a/src/equicordplugins/hideServers/index.tsx +++ b/src/equicordplugins/hideServers/index.tsx @@ -77,7 +77,7 @@ export default definePlugin({ find: '("guildsnav")', replacement: [ { - match: /(?<=#{intl::SERVERS}"\]\),children:.{0,300}?)(\i)(\)?\.map\(\i\))/, + match: /(?<=#{intl::SERVERS}\),children:.{0,300}?)(\i)(\)?\.map\(\i\))/, replace: "$self.useFilteredGuilds($1)$2", }, // despite my best efforts, the above doesnt trigger a rerender diff --git a/src/equicordplugins/identity/index.tsx b/src/equicordplugins/identity/index.tsx index 729f5832e..b39e1683a 100644 --- a/src/equicordplugins/identity/index.tsx +++ b/src/equicordplugins/identity/index.tsx @@ -140,7 +140,7 @@ export default definePlugin({ { find: "DefaultCustomizationSections", replacement: { - match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}},"decoration"\),)/, + match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/, replace: "$self.ResetCard()," } }, diff --git a/src/equicordplugins/loginWithQR/index.tsx b/src/equicordplugins/loginWithQR/index.tsx index dc7538f7f..955576ab0 100644 --- a/src/equicordplugins/loginWithQR/index.tsx +++ b/src/equicordplugins/loginWithQR/index.tsx @@ -59,13 +59,13 @@ export default definePlugin({ replacement: { // Find the Edit User Profile button and insert our custom button. // A bit jank, but whatever - match: /,(.{11}\.Button,.{58}\.USER_SETTINGS_EDIT_USER_PROFILE}\))/, + match: /,(.{0,20}\.Button,.{0,100}#{intl::USER_SETTINGS_EDIT_USER_PROFILE}\)}\))/, replace: ",$self.insertScanQrButton($1)", }, }, // Insert a Scan QR Code MenuItem in the Swith Accounts popout { - find: "#{intl::SWITCH_ACCOUNTS_MANAGE_ACCOUNTS},", + find: 'id:"manage-accounts"', replacement: { match: /(id:"manage-accounts",.*?)}\)\)(,\i)/, replace: "$1}),$self.ScanQrMenuItem)$2" diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index f2083e552..f02e6dc3d 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -32,7 +32,7 @@ export default definePlugin({ patches: [ { - find: "#{intl::STICKER_BUTTON_LABEL},", + find: "#{intl::STICKER_BUTTON_LABEL}", replacement: [{ match: /(children:\(0,\w\.jsx\)\()([\w.]+?)(,{innerClassName.{10,30}\.stickerButton)/, replace: (_, head, button, tail) => { @@ -66,7 +66,7 @@ export default definePlugin({ { find: "#{intl::EXPRESSION_PICKER_GIF}", replacement: { - match: /role:"tablist",.+?#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL},children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, + match: /role:"tablist",.+?#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL}\),children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, replace: m => { const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,10}#{intl::EXPRESSION_PICKER_STICKER}).*?:null/s; const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => { diff --git a/src/equicordplugins/noAppsAllowed/index.tsx b/src/equicordplugins/noAppsAllowed/index.tsx index a435e6374..560ecf679 100644 --- a/src/equicordplugins/noAppsAllowed/index.tsx +++ b/src/equicordplugins/noAppsAllowed/index.tsx @@ -14,9 +14,9 @@ export default definePlugin({ patches: [ { - find: "BOT:default:", + find: "#{intl::APP_TAG})", replacement: { - match: /(default:\i)=.{0,30}\)/, + match: /(default:\i)=\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/, replace: "$1=\"BOT\"" } } diff --git a/src/equicordplugins/pinIcon/index.tsx b/src/equicordplugins/pinIcon/index.tsx index bd13a5c1a..cb603e6e5 100644 --- a/src/equicordplugins/pinIcon/index.tsx +++ b/src/equicordplugins/pinIcon/index.tsx @@ -27,9 +27,9 @@ export default definePlugin({ authors: [EquicordDevs.iamme], patches: [ { - find: "#{intl::MESSAGE_EDITED},", + find: "#{intl::MESSAGE_EDITED}),", replacement: { - match: /#{intl::MESSAGE_EDITED},(?:[^}]*[}]){3}\)/, + match: /#{intl::MESSAGE_EDITED}\),(?:[^}]*[}]){3}\)/, replace: "$&,$self.PinnedIcon(arguments[0].message)" } } diff --git a/src/equicordplugins/statusPresets/index.tsx b/src/equicordplugins/statusPresets/index.tsx index ddebc3162..5889448d4 100644 --- a/src/equicordplugins/statusPresets/index.tsx +++ b/src/equicordplugins/statusPresets/index.tsx @@ -133,12 +133,12 @@ export default definePlugin({ { find: "#{intl::CUSTOM_STATUS_SET_CUSTOM_STATUS}", replacement: { - match: /\.ModalFooter,.{0,70}\.Messages\.SAVE\}\)/, + match: /\.ModalFooter,.{0,70}\i\.\i\.string\(\i\.\i#{intl::SAVE}\)\}\)/, replace: "$&,$self.renderRememberButton(this.state)" } }, { - find: '"aria-label":#{intl::STATUS_MENU_LABEL}', + find: /"aria-label":.{0,1}\.\i\.string\(\i\.\i#{intl::STATUS_MENU_LABEL}/, replacement: { match: /!\i&&(.{0,15}\i\.Fragment.{0,55}null==(\i).{0,200}customEmojiPlaceholder\}\),onClick:([^}]+}))/, replace: "$self.render($2, $3),false&&$1" diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 01ace3a19..2b2c2cc62 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -32,10 +32,10 @@ export default definePlugin({ } }, { - find: '#{intl::SERVERS}"]),children', + find: "#{intl::SERVERS}),children", replacement: [ { - match: /(?<=#{intl::SERVERS}"\]\),children:)\i\.map\(\i\)/, + match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/, replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" }, { From cb955861840465ba318047cf89c89a34b46aa181 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 3 Nov 2024 21:42:20 -0500 Subject: [PATCH 27/28] Fix NoAppsAllowed --- src/equicordplugins/noAppsAllowed/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/equicordplugins/noAppsAllowed/index.tsx b/src/equicordplugins/noAppsAllowed/index.tsx index 560ecf679..70b1443cb 100644 --- a/src/equicordplugins/noAppsAllowed/index.tsx +++ b/src/equicordplugins/noAppsAllowed/index.tsx @@ -16,8 +16,8 @@ export default definePlugin({ { find: "#{intl::APP_TAG})", replacement: { - match: /(default:\i)=\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/, - replace: "$1=\"BOT\"" + match: /\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/, + replace: '"BOT"' } } ], From bb6e60b44d1e02978c562fb7318a44be76d26659 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Mon, 4 Nov 2024 02:53:44 -0500 Subject: [PATCH 28/28] Fix Settings Sorting --- src/plugins/_core/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index c174073af..4c49a2a2c 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -178,7 +178,7 @@ export default definePlugin({ patchedSettings: new WeakSet(), addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) { - if (this.patchedSettings.has(elements)) return; + if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return; this.patchedSettings.add(elements);