From 522e2b5b8ff3026edecebf11e9c09a73a431b4fd Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Tue, 17 Jun 2025 00:04:19 -0400 Subject: [PATCH] Patch Fixes --- .../customUserColors/index.tsx | 2 +- src/equicordplugins/equicordHelper/index.tsx | 9 +++++++ .../fixFileExtensions/index.tsx | 6 +---- src/equicordplugins/moreStickers/upload.ts | 26 +++---------------- src/equicordplugins/vencordRPC/index.ts | 10 ++++--- src/plugins/anonymiseFileNames/index.tsx | 6 +---- src/plugins/ircColors/index.ts | 2 +- src/plugins/noBlockedMessages/index.ts | 2 +- src/plugins/quickReply/index.ts | 3 --- src/webpack/common/stores.ts | 1 + 10 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index f77749e5..c9dae89e 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -96,7 +96,7 @@ export default definePlugin({ find: '="SYSTEM_TAG"', replacement: { // Override colorString with our custom color and disable gradients if applying the custom color. - match: /&&null!=\i\.secondaryColor,(?<=colorString:(\i).+?(\i)=.+?)/, + match: /useContext\(\i\.\i\),(?<=colorString:(\i).+?(\i)=.+?)/, replace: (m, colorString, hasGradientColors) => `${m}` + `vcCustomUserColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),` }, diff --git a/src/equicordplugins/equicordHelper/index.tsx b/src/equicordplugins/equicordHelper/index.tsx index 7b50c43a..0fe811ad 100644 --- a/src/equicordplugins/equicordHelper/index.tsx +++ b/src/equicordplugins/equicordHelper/index.tsx @@ -50,6 +50,7 @@ export default definePlugin({ settings, required: true, patches: [ + // Fixes Unknown Resolution/FPS Crashing { find: "Unknown resolution:", replacement: [ @@ -62,6 +63,14 @@ export default definePlugin({ replace: "return $1;" } ] + }, + // Adds getRelationships Back To The RelationshipStore + { + find: "getRelationshipCount(){", + replacement: { + match: /(?<=getRelationshipCount\(\)\{.{0,25}\})(?=.*?getFriendIDs\(\)\{.{0,25}.keys\((\i)\))/, + replace: "getRelationships(){return $1}" + } } ], start() { diff --git a/src/equicordplugins/fixFileExtensions/index.tsx b/src/equicordplugins/fixFileExtensions/index.tsx index e4664a7e..70509316 100644 --- a/src/equicordplugins/fixFileExtensions/index.tsx +++ b/src/equicordplugins/fixFileExtensions/index.tsx @@ -32,12 +32,8 @@ export default definePlugin({ patches: [ // Taken from AnonymiseFileNames { - find: "async uploadFiles(", + find: "async uploadFilesSimple(", replacement: [ - { - match: /async uploadFiles\((\i),\i\){/, - replace: "$&$1.forEach($self.fixExt);" - }, { match: /async uploadFilesSimple\((\i)\){/, replace: "$&$1.forEach($self.fixExt);" diff --git a/src/equicordplugins/moreStickers/upload.ts b/src/equicordplugins/moreStickers/upload.ts index 59ad2d09..6b924197 100644 --- a/src/equicordplugins/moreStickers/upload.ts +++ b/src/equicordplugins/moreStickers/upload.ts @@ -6,13 +6,11 @@ import { FFmpeg } from "@ffmpeg/ffmpeg"; import { fetchFile } from "@ffmpeg/util"; -import { findByPropsLazy, findLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { ChannelStore, UploadHandler } from "@webpack/common"; import { FFmpegState, Sticker } from "./types"; -const MessageUpload = findByPropsLazy("uploadFiles"); -const CloudUpload = findLazy(m => m.prototype?.trackUploadFinished); const PendingReplyStore = findByPropsLazy("getPendingReply"); const MessageUtils = findByPropsLazy("sendMessage"); const DraftStore = findByPropsLazy("getDraft", "getState"); @@ -159,26 +157,8 @@ export async function sendSticker({ file = new File([processedImage], filename!, { type: mimeType }); } - if (ctrlKey) { - UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), 0); - return; - } - - MessageUpload.uploadFiles({ - channelId, - draftType: 0, - hasSpoiler: false, - options: messageOptions || {}, - parsedMessage: { - content: messageContent - }, - uploads: [ - new CloudUpload({ - file, - platform: 1 - }, channelId, false, 0) - ] - }); + UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), 0); + return; } else if (shiftKey) { if (!messageContent.endsWith(" ") || !messageContent.endsWith("\n")) messageContent += " "; messageContent += sticker.image; diff --git a/src/equicordplugins/vencordRPC/index.ts b/src/equicordplugins/vencordRPC/index.ts index d1900df0..ed6ec655 100644 --- a/src/equicordplugins/vencordRPC/index.ts +++ b/src/equicordplugins/vencordRPC/index.ts @@ -192,15 +192,17 @@ function isTimestampDisabled() { function onlineFriendCount(): number { let onlineFriends = 0; - const relationships = RelationshipStore.getRelationships(); - for (const id in relationships) { - if (relationships[id] === 1 && PresenceStore.getStatus(id) !== "offline") onlineFriends++; + const relationships = RelationshipStore.getFriendIDs(); + for (const id of relationships) { + if (PresenceStore.getStatus(id) !== "offline") { + onlineFriends++; + } } return onlineFriends; } function totalFriendCount(): number { - return Object.values(RelationshipStore.getRelationships()).filter(r => r === 1).length; + return RelationshipStore.getFriendCount(); } function memberCount(): string { diff --git a/src/plugins/anonymiseFileNames/index.tsx b/src/plugins/anonymiseFileNames/index.tsx index 51e3e5ca..e0372b9c 100644 --- a/src/plugins/anonymiseFileNames/index.tsx +++ b/src/plugins/anonymiseFileNames/index.tsx @@ -79,12 +79,8 @@ export default definePlugin({ patches: [ { - find: "async uploadFiles(", + find: "async uploadFilesSimple(", replacement: [ - { - match: /async uploadFiles\((\i),\i\){/, - replace: "$&$1.forEach($self.anonymise);" - }, { match: /async uploadFilesSimple\((\i)\){/, replace: "$&$1.forEach($self.anonymise);" diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 4f71e228..c9d2c613 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -68,7 +68,7 @@ export default definePlugin({ find: '="SYSTEM_TAG"', replacement: { // Override colorString with our custom color and disable gradients if applying the custom color. - match: /&&null!=\i\.secondaryColor,(?<=colorString:(\i).+?(\i)=.+?)/, + match: /useContext\(\i\.\i\),(?<=colorString:(\i).+?(\i)=.+?)/, replace: (m, colorString, hasGradientColors) => `${m}` + `vcIrcColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),` } diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index d4d7b3f9..81265d41 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -25,7 +25,7 @@ import { findByPropsLazy } from "@webpack"; import { i18n, MessageStore } from "@webpack/common"; import { Message } from "discord-types/general"; -const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); +const RelationshipStore = findByPropsLazy("getFriendIDs", "isBlocked"); interface MessageDeleteProps { // Internal intl message for BLOCKED_MESSAGE_COUNT diff --git a/src/plugins/quickReply/index.ts b/src/plugins/quickReply/index.ts index 5a6b45f9..e5d52085 100644 --- a/src/plugins/quickReply/index.ts +++ b/src/plugins/quickReply/index.ts @@ -19,14 +19,11 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy } from "@webpack"; import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageActions, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { Message } from "discord-types/general"; import NoBlockedMessagesPlugin from "plugins/noBlockedMessages"; import NoReplyMentionPlugin from "plugins/noReplyMention"; -const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); - const isMac = navigator.platform.includes("Mac"); // bruh let currentlyReplyingId: string | null = null; let currentlyEditingId: string | null = null; diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index 94484f5c..8fd93bde 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -49,6 +49,7 @@ export let TypingStore: GenericStore; export let GuildMemberStore: Stores.GuildMemberStore & t.FluxStore; export let RelationshipStore: Stores.RelationshipStore & t.FluxStore & { /** Get the date (as a string) that the relationship was created */ + getFriendCount(): number; getSince(userId: string): string; isIgnored(userId: string): boolean; };