diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts index b4033ecb..0a17e8d7 100644 --- a/scripts/generateReport.ts +++ b/scripts/generateReport.ts @@ -350,7 +350,7 @@ function runTime(token: string) { let invalidEntryPoint = false; for (const id of chunkIds) { - if (!wreq.u(id)) continue; + if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue; const isWasm = await fetch(wreq.p + wreq.u(id)) .then(r => r.text()) @@ -376,9 +376,22 @@ function runTime(token: string) { } catch (err) { } } - const allChunks = Function("return " + (wreq.u.toString().match(/(?<=\()\{.+?\}/s)?.[0] ?? "null"))() as Record | null; - if (!allChunks) throw new Error("Failed to get all chunks"); - const chunksLeft = Object.keys(allChunks).filter(id => { + // Matches "id" or id: + const chunkIdRegex = /(?:"(\d+?)")|(?:(\d+?):)/g; + const wreqU = wreq.u.toString(); + + const allChunks = [] as string[]; + let currentMatch: RegExpExecArray | null; + + while ((currentMatch = chunkIdRegex.exec(wreqU)) != null) { + const id = currentMatch[1] ?? currentMatch[2]; + if (id == null) continue; + + allChunks.push(id); + } + + if (allChunks.length === 0) throw new Error("Failed to get all chunks"); + const chunksLeft = allChunks.filter(id => { return !(validChunks.has(id) || invalidChunks.has(id)); }); diff --git a/src/plugins/blurNsfw/index.ts b/src/plugins/blurNsfw/index.ts index cb6be54c..a80f9f26 100644 --- a/src/plugins/blurNsfw/index.ts +++ b/src/plugins/blurNsfw/index.ts @@ -45,8 +45,8 @@ export default definePlugin({ { find: ".embedWrapper,embed", replacement: [{ - match: /\.embedWrapper/g, - replace: "$&+(this.props.channel.nsfw?' vc-nsfw-img':'')" + match: /\.embedWrapper(?=.+?channel_id:(\i)\.id)/g, + replace: "$&+($1.nsfw?' vc-nsfw-img':'')" }] } ], diff --git a/src/plugins/dearrow/index.tsx b/src/plugins/dearrow/index.tsx index 80eb84aa..b02c80d3 100644 --- a/src/plugins/dearrow/index.tsx +++ b/src/plugins/dearrow/index.tsx @@ -147,7 +147,7 @@ export default definePlugin({ replacement: [ // patch componentDidMount to replace embed thumbnail and title { - match: /render\(\)\{let\{embed:/, + match: /render\(\)\{.{0,30}let\{embed:/, replace: "componentDidMount=$self.embedDidMount;$&" }, diff --git a/src/plugins/fixImagesQuality/index.ts b/src/plugins/fixImagesQuality/index.ts deleted file mode 100644 index 4acd9a92..00000000 --- a/src/plugins/fixImagesQuality/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "FixImagesQuality", - description: "Fixes the quality of images in the chat being horrible.", - authors: [Devs.Nuckyz], - patches: [ - { - find: "handleImageLoad=", - replacement: [ - { - match: /(?<=getSrc\(\i\){.+?return )\i\.SUPPORTS_WEBP.+?:(?=\i&&\(\i="png"\))/, - replace: "" - } - ] - } - ] -}); diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index 99cee5b1..51feb916 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -16,10 +16,11 @@ * along with this program. If not, see . */ +import { definePluginSettings } from "@api/Settings"; import { disableStyle, enableStyle } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { findComponentByCodeLazy } from "@webpack"; import { StatusSettingsStores } from "@webpack/common"; @@ -28,22 +29,31 @@ import style from "./style.css?managed"; const Button = findComponentByCodeLazy("Button.Sizes.NONE,disabled:"); function makeIcon(showCurrentGame?: boolean) { - const controllerIcon = "M3.06 20.4q-1.53 0-2.37-1.065T.06 16.74l1.26-9q.27-1.8 1.605-2.97T6.06 3.6h11.88q1.8 0 3.135 1.17t1.605 2.97l1.26 9q.21 1.53-.63 2.595T20.94 20.4q-.63 0-1.17-.225T18.78 19.5l-2.7-2.7H7.92l-2.7 2.7q-.45.45-.99.675t-1.17.225Zm14.94-7.2q.51 0 .855-.345T19.2 12q0-.51-.345-.855T18 10.8q-.51 0-.855.345T16.8 12q0 .51.345 .855T18 13.2Zm-2.4-3.6q.51 0 .855-.345T16.8 8.4q0-.51-.345-.855T15.6 7.2q-.51 0-.855.345T14.4 8.4q0 .51.345 .855T15.6 9.6ZM6.9 13.2h1.8v-2.1h2.1v-1.8h-2.1v-2.1h-1.8v2.1h-2.1v1.8h2.1v2.1Z"; + const { oldIcon } = settings.use(["oldIcon"]); + + const redLinePath = !oldIcon + ? "M22.7 2.7a1 1 0 0 0-1.4-1.4l-20 20a1 1 0 1 0 1.4 1.4Z" + : "M23 2.27 21.73 1 1 21.73 2.27 23 23 2.27Z"; + + const maskBlackPath = !oldIcon + ? "M23.27 4.73 19.27 .73 -.27 20.27 3.73 24.27Z" + : "M23.27 4.54 19.46.73 .73 19.46 4.54 23.27 23.27 4.54Z"; + return function () { return ( - {showCurrentGame ? ( - - ) : ( - <> - - - - - - - - )} + + {!showCurrentGame && <> + + + + + + } ); }; @@ -63,10 +73,19 @@ function GameActivityToggleButton() { ); } +const settings = definePluginSettings({ + oldIcon: { + type: OptionType.BOOLEAN, + description: "Use the old icon style before Discord icon redesign", + default: false + } +}); + export default definePlugin({ name: "GameActivityToggle", description: "Adds a button next to the mic and deafen button to toggle game activity.", authors: [Devs.Nuckyz, Devs.RuukuLada], + settings, patches: [ { diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index ac43a9f0..ef0aa03b 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -328,6 +328,7 @@ export default definePlugin({ // Attachment renderer // Module 96063 find: ".removeAttachmentHoverButton", + group: true, replacement: [ { match: /(className:\i,attachment:\i),/, diff --git a/src/plugins/nsfwGateBypass/index.ts b/src/plugins/nsfwGateBypass/index.ts index 3c5dbb4c..b6f0f3e8 100644 --- a/src/plugins/nsfwGateBypass/index.ts +++ b/src/plugins/nsfwGateBypass/index.ts @@ -27,8 +27,8 @@ export default definePlugin({ { find: ".nsfwAllowed=null", replacement: { - match: /(\w+)\.nsfwAllowed=/, - replace: "$1.nsfwAllowed=true;", + match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/, + replace: "!0", }, }, ], diff --git a/src/plugins/showConnections/index.tsx b/src/plugins/showConnections/index.tsx index d4d59465..83600e86 100644 --- a/src/plugins/showConnections/index.tsx +++ b/src/plugins/showConnections/index.tsx @@ -33,6 +33,7 @@ import { VerifiedIcon } from "./VerifiedIcon"; const Section = findComponentByCodeLazy(".lastSection", "children:"); const ThemeStore = findStoreLazy("ThemeStore"); +const platformHooks: { useLegacyPlatformType(platform: string): string; } = findByPropsLazy("useLegacyPlatformType"); const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl"); const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"'); @@ -111,7 +112,7 @@ function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) { } function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) { - const platform = platforms.get(connection.type); + const platform = platforms.get(platformHooks.useLegacyPlatformType(connection.type)); const url = platform.getPlatformUserUrl?.(connection); const img = (