From 467c5e0c4c00b021ec8ae8ecf0ee929630ec7f31 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Sun, 17 Dec 2023 17:40:59 -0300
Subject: [PATCH 1/7] Delete FixImagesQuality
Discord fixed their issue with images getting converted to webp losing quality. In the future this plugin can be re-purposed to keep images format as the original, but that requires more than just removing part of the Discord code, and a bit of study to make sure it does not cause issues.
---
src/plugins/fixImagesQuality/index.ts | 25 -------------------------
1 file changed, 25 deletions(-)
delete mode 100644 src/plugins/fixImagesQuality/index.ts
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: ""
- }
- ]
- }
- ]
-});
From 9950bf00b276b69819cdb41d570877662c66e511 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Sun, 17 Dec 2023 18:06:16 -0300
Subject: [PATCH 2/7] GameActivityToggle: option to use old icon
---
src/plugins/gameActivityToggle/index.tsx | 47 +++++++++++++++++-------
1 file changed, 33 insertions(+), 14 deletions(-)
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 (
);
};
@@ -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: [
{
From 2e04b3d1ef34a21fb2c897bef8e4ea908c2de9c4 Mon Sep 17 00:00:00 2001
From: TheKodeToad
Date: Sun, 17 Dec 2023 21:12:42 +0000
Subject: [PATCH 3/7] Implement Twitter easter egg for ShowConnections (#2062)
---
src/plugins/showConnections/index.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 = (
From fdf3480b278536bb85759345279715575480dce0 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Wed, 20 Dec 2023 01:33:40 -0300
Subject: [PATCH 4/7] Fix DeArrow patch
---
src/plugins/dearrow/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;$&"
},
From 686f2d925f5d3f238b813481f827b7cd9ce2e0eb Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Thu, 21 Dec 2023 23:41:12 +0100
Subject: [PATCH 5/7] fix canary crashing
---
src/plugins/blurNsfw/index.ts | 4 ++--
src/plugins/messageLogger/index.tsx | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
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/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),/,
From 109d842e29476b140293ac4c3103a3ffa4dd3953 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Thu, 21 Dec 2023 21:46:22 -0300
Subject: [PATCH 6/7] Fix NSFWGateBypass possibly Vencord
---
src/plugins/nsfwGateBypass/index.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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",
},
},
],
From 5dee2e8549de195f7bdb213ce7bb7f6dde840811 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Thu, 21 Dec 2023 21:46:34 -0300
Subject: [PATCH 7/7] Future proof reporter to work in latest canary
---
scripts/generateReport.ts | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
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));
});