From c3852cb892e88eef6509d5114bd17910e72703cb Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Jul 2024 02:34:05 +0200 Subject: [PATCH 1/5] fix badges on canary --- package.json | 1 + src/plugins/_api/badges/index.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cfd4bd010..5d8f9f97d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "buildReporter": "pnpm buildWebStandalone --reporter --skip-extension", "buildReporterDesktop": "pnpm build --reporter", "watch": "pnpm build --watch", + "dev": "pnpm watch", "watchWeb": "pnpm buildWeb --watch", "generatePluginJson": "tsx scripts/generatePluginList.ts", "generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types", diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index 94dc673a5..89a992ac3 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -91,7 +91,7 @@ export default definePlugin({ /* new profiles */ { - find: ".PANEL]:14", + find: ".FULL_SIZE]:26", replacement: { match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/, replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&" From 67632ecc113ef490a322c894c6bb11e9c4c4b2e7 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Jul 2024 02:35:53 +0200 Subject: [PATCH 2/5] MentionAvatars: fix mentions being ultra wide in topics --- src/plugins/mentionAvatars/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mentionAvatars/styles.css b/src/plugins/mentionAvatars/styles.css index 33404d7b5..022f968c0 100644 --- a/src/plugins/mentionAvatars/styles.css +++ b/src/plugins/mentionAvatars/styles.css @@ -1,6 +1,6 @@ .vc-mentionAvatars-avatar { vertical-align: middle; - width: 1em; + width: 1em !important; /* insane discord sets width: 100% in channel topic */ height: 1em; margin: 0 4px 0.2rem 2px; border-radius: 50%; From 80b493d7a863831e7770463f03d56048ae9bdced Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 17 Jul 2024 21:30:10 +0200 Subject: [PATCH 3/5] WhoReacted: fix errors --- src/plugins/messageLinkEmbeds/index.tsx | 1 + src/plugins/whoReacted/index.tsx | 32 +++++++++++++------------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/plugins/messageLinkEmbeds/index.tsx b/src/plugins/messageLinkEmbeds/index.tsx index cf180d0d4..9fd677389 100644 --- a/src/plugins/messageLinkEmbeds/index.tsx +++ b/src/plugins/messageLinkEmbeds/index.tsx @@ -147,6 +147,7 @@ async function fetchMessage(channelID: string, messageID: string) { if (!msg) return; const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id); + if (!message) return; messageCache.set(message.id, { message, diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index 5721dc912..679fe714e 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -43,14 +43,23 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) { }, oldFormErrors: true }) - .then(res => FluxDispatcher.dispatch({ - type: "MESSAGE_REACTION_ADD_USERS", - channelId: msg.channel_id, - messageId: msg.id, - users: res.body, - emoji, - reactionType: type - })) + .then(res => { + for (const user of res.body) { + FluxDispatcher.dispatch({ + type: "USER_UPDATE", + user + }); + } + + FluxDispatcher.dispatch({ + type: "MESSAGE_REACTION_ADD_USERS", + channelId: msg.channel_id, + messageId: msg.id, + users: res.body, + emoji, + reactionType: type + }); + }) .catch(console.error) .finally(() => sleep(250)); } @@ -148,13 +157,6 @@ export default definePlugin({ const reactions = getReactionsWithQueue(message, emoji, type); const users = Object.values(reactions).filter(Boolean) as User[]; - for (const user of users) { - FluxDispatcher.dispatch({ - type: "USER_UPDATE", - user - }); - } - return (
Date: Fri, 19 Jul 2024 00:46:48 -0300 Subject: [PATCH 4/5] Fix loading scientific notation chunks --- src/debug/loadLazyChunks.ts | 18 +++++++++--------- src/webpack/webpack.ts | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/debug/loadLazyChunks.ts b/src/debug/loadLazyChunks.ts index 64c3e0ead..d3484bd9a 100644 --- a/src/debug/loadLazyChunks.ts +++ b/src/debug/loadLazyChunks.ts @@ -15,9 +15,9 @@ export async function loadLazyChunks() { try { LazyChunkLoaderLogger.log("Loading all chunks..."); - const validChunks = new Set(); - const invalidChunks = new Set(); - const deferredRequires = new Set(); + const validChunks = new Set(); + const invalidChunks = new Set(); + const deferredRequires = new Set(); let chunksSearchingResolve: (value: void | PromiseLike) => void; const chunksSearchingDone = new Promise(r => chunksSearchingResolve = r); @@ -29,14 +29,14 @@ export async function loadLazyChunks() { async function searchAndLoadLazyChunks(factoryCode: string) { const lazyChunks = factoryCode.matchAll(LazyChunkRegex); - const validChunkGroups = new Set<[chunkIds: string[], entryPoint: string]>(); + const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>(); // 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"); await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => { - const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => m[1]) : []; + const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : []; if (chunkIds.length === 0) { return; @@ -61,7 +61,7 @@ export async function loadLazyChunks() { } if (!invalidChunkGroup) { - validChunkGroups.add([chunkIds, entryPoint]); + validChunkGroups.add([chunkIds, Number(entryPoint)]); } })); @@ -131,14 +131,14 @@ export async function loadLazyChunks() { } // All chunks Discord has mapped to asset files, even if they are not used anymore - const allChunks = [] as string[]; + const allChunks = [] as number[]; // Matches "id" or id: - for (const currentMatch of wreq!.u.toString().matchAll(/(?:"(\d+?)")|(?:(\d+?):)/g)) { + for (const currentMatch of wreq!.u.toString().matchAll(/(?:"([\deE]+?)")|(?:([\deE]+?):)/g)) { const id = currentMatch[1] ?? currentMatch[2]; if (id == null) continue; - allChunks.push(id); + allChunks.push(Number(id)); } if (allChunks.length === 0) throw new Error("Failed to get all chunks"); diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index f21a38d67..272ecd94f 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -544,7 +544,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D } if (rawChunkIds) { - const chunkIds = Array.from(rawChunkIds.matchAll(ChunkIdsRegex)).map((m: any) => m[1]); + const chunkIds = Array.from(rawChunkIds.matchAll(ChunkIdsRegex)).map((m: any) => Number(m[1])); await Promise.all(chunkIds.map(id => wreq.e(id))); } @@ -559,7 +559,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D return false; } - wreq(entryPointId); + wreq(Number(entryPointId)); return true; } From 2044264729f6af2c9af1f236c2f3aaa00601cab3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 23 Jul 2024 02:56:24 +0200 Subject: [PATCH 5/5] fix PictureInPicture on canary --- src/plugins/pictureInPicture/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/pictureInPicture/index.tsx b/src/plugins/pictureInPicture/index.tsx index 0a22f06db..81d75a256 100644 --- a/src/plugins/pictureInPicture/index.tsx +++ b/src/plugins/pictureInPicture/index.tsx @@ -30,7 +30,7 @@ export default definePlugin({ { find: ".nonMediaMosaicItem]", replacement: { - match: /\.nonMediaMosaicItem\]:!(\i).{0,10}children:\[(\S)/, + match: /\.nonMediaMosaicItem\]:!(\i).{0,50}?children:\[(\S)/, replace: "$&,$1&&$2&&$self.renderPiPButton()," }, },