From 88f353e7f6e40f561c8ed7150fcdc32ed4491f18 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:39:28 -0300 Subject: [PATCH 01/41] ResurrectHome: Fix Force Server Home patch --- src/plugins/resurrectHome/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/resurrectHome/index.tsx b/src/plugins/resurrectHome/index.tsx index f48debc76..24cdf2b02 100644 --- a/src/plugins/resurrectHome/index.tsx +++ b/src/plugins/resurrectHome/index.tsx @@ -89,8 +89,8 @@ export default definePlugin({ { find: "61eef9_2", replacement: { - match: /(?<=getMutableGuildChannelsForGuild\(\i\)\);)(?=if\(null==\i\|\|)/, - replace: "if($self.useForceServerHome())return false;" + match: /getMutableGuildChannelsForGuild\(\i\);return\(0,\i\.useStateFromStores\).+?\]\)(?=}function)/, + replace: m => `${m}&&!$self.useForceServerHome()` } } ], From 18d47806358f0b5e4e82d58b4767743ff384970a Mon Sep 17 00:00:00 2001 From: Kyuuhachi <1547062+Kyuuhachi@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:51:28 +0200 Subject: [PATCH 02/41] fix(MessageLinkEmbeds): Actually disable when disabled (#2323) --- src/plugins/messageLinkEmbeds/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/messageLinkEmbeds/index.tsx b/src/plugins/messageLinkEmbeds/index.tsx index 6ee60be71..2a5f88282 100644 --- a/src/plugins/messageLinkEmbeds/index.tsx +++ b/src/plugins/messageLinkEmbeds/index.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { addAccessory } from "@api/MessageAccessories"; +import { addAccessory, removeAccessory } from "@api/MessageAccessories"; import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants.js"; @@ -389,4 +389,8 @@ export default definePlugin({ ); }, 4 /* just above rich embeds */); }, + + stop() { + removeAccessory("messageLinkEmbed"); + } }); From 778d79cd35cf4710640ac7563d6e22eb1deb78ca Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:09:04 -0300 Subject: [PATCH 03/41] Fix MutualGroupDMs and UserVoiceShow patch --- src/plugins/mutualGroupDMs/index.tsx | 2 +- src/plugins/userVoiceShow/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index f5e4b6149..1753fefbc 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -45,7 +45,7 @@ export default definePlugin({ patches: [ { - find: ".Messages.USER_PROFILE_MODAL", // Note: the module is lazy-loaded + find: ".Messages.MUTUAL_GUILDS_WITH_END_COUNT", // Note: the module is lazy-loaded replacement: { match: /(?<=\.tabBarItem.{0,50}MUTUAL_GUILDS.+?}\),)(?=.+?(\(0,\i\.jsxs?\)\(.{0,100}id:))/, replace: '(arguments[0].user.bot||arguments[0].isCurrentUser)?null:$1"MUTUAL_GDMS",children:"Mutual Groups"}),' diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index 200cfe895..feba28316 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -104,7 +104,7 @@ export default definePlugin({ }, // below username { - find: ".USER_PROFILE_MODAL", + find: ".Messages.MUTUAL_GUILDS_WITH_END_COUNT", // Lazy-loaded replacement: { match: /\.body.+?displayProfile:\i}\),/, replace: "$&$self.patchModal(arguments[0]),", From c311155d7cba0658eaba6ba8b081e465cc18bceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jade=20=E3=83=BB=3A*=E3=83=BB=E3=80=82*=E3=83=BB?= Date: Sat, 6 Apr 2024 06:29:08 +1100 Subject: [PATCH 04/41] PinDMs: Fix unexpected behaviours when using last message sort (#2324) --- src/plugins/pinDms/data.ts | 9 +++++++-- src/plugins/pinDms/index.tsx | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/pinDms/data.ts b/src/plugins/pinDms/data.ts index afb6f9795..a4e40dde0 100644 --- a/src/plugins/pinDms/data.ts +++ b/src/plugins/pinDms/data.ts @@ -9,7 +9,7 @@ import { Settings } from "@api/Settings"; import { UserStore } from "@webpack/common"; import { DEFAULT_COLOR } from "./constants"; -import { forceUpdate } from "./index"; +import { forceUpdate, PinOrder, PrivateChannelSortStore, settings } from "./index"; export interface Category { id: string; @@ -106,7 +106,12 @@ export function categoryLen() { } export function getAllUncollapsedChannels() { - return categories.filter(c => !c.collapsed).map(c => c.channels).flat(); + if (settings.store.pinOrder === PinOrder.LastMessage) { + const sortedChannels = PrivateChannelSortStore.getPrivateChannelIds(); + return categories.filter(c => !c.collapsed).flatMap(c => sortedChannels.filter(channel => c.channels.includes(channel))); + } + + return categories.filter(c => !c.collapsed).flatMap(c => c.channels); } export function getSections() { diff --git a/src/plugins/pinDms/index.tsx b/src/plugins/pinDms/index.tsx index 353fc482a..010b5506c 100644 --- a/src/plugins/pinDms/index.tsx +++ b/src/plugins/pinDms/index.tsx @@ -29,7 +29,7 @@ interface ChannelComponentProps { const headerClasses = findByPropsLazy("privateChannelsHeaderContainer"); -const PrivateChannelSortStore = findStoreLazy("PrivateChannelSortStore") as { getPrivateChannelIds: () => string[]; }; +export const PrivateChannelSortStore = findStoreLazy("PrivateChannelSortStore") as { getPrivateChannelIds: () => string[]; }; export let instance: any; export const forceUpdate = () => instance?.props?._forceUpdate?.(); @@ -236,7 +236,7 @@ export default definePlugin({ const category = categories[categoryIndex - 1]; if (!category) return false; - return category.collapsed && this.instance.props.selectedChannelId !== category.channels[channelIndex]; + return category.collapsed && this.instance.props.selectedChannelId !== this.getCategoryChannels(category)[channelIndex]; }, getScrollOffset(channelId: string, rowHeight: number, padding: number, preRenderedChildren: number, originalOffset: number) { From e0becc1ba0c5d7e93b758188865f1d53b7dca0a0 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sun, 7 Apr 2024 21:46:32 +0200 Subject: [PATCH 05/41] ShowHiddenChannels: Fix incompatibility with favorite channels experiment --- src/plugins/showHiddenChannels/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 31dc93ad2..ce4a47ade 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -452,7 +452,7 @@ export default definePlugin({ { // Filter hidden channels from GuildChannelStore.getChannels unless told otherwise match: /(?<=getChannels\(\i)(\){.+?)return (.+?)}/, - replace: (_, rest, channels) => `,shouldIncludeHidden${rest}return $self.resolveGuildChannels(${channels},shouldIncludeHidden??false);}` + replace: (_, rest, channels) => `,shouldIncludeHidden${rest}return $self.resolveGuildChannels(${channels},shouldIncludeHidden??arguments[0]==="@favorites");}` } ] }, From cba611c1cc46099a191cad64995dc8af8dce7d1a Mon Sep 17 00:00:00 2001 From: Eric <45801973+waresnew@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:33:35 -0400 Subject: [PATCH 06/41] Better error for primitives on proxyLazy + fix StartupTimings (#2339) --- src/plugins/startupTimings/index.tsx | 5 +++-- src/utils/lazy.ts | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index c7417f0fc..742d822ae 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -17,9 +17,10 @@ */ import { Devs } from "@utils/constants"; -import { LazyComponent } from "@utils/react"; import definePlugin from "@utils/types"; +import StartupTimingPage from "./StartupTimingPage"; + export default definePlugin({ name: "StartupTimings", description: "Adds Startup Timings to the Settings menu", @@ -31,5 +32,5 @@ export default definePlugin({ replace: '{section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage},$&' } }], - StartupTimingPage: LazyComponent(() => require("./StartupTimingPage").default) + StartupTimingPage }); diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 32336fb40..a61785df9 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -116,8 +116,11 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild = false): T attempts, true ); - - return Reflect.get(target[kGET](), p, receiver); + const lazyTarget = target[kGET](); + if (typeof lazyTarget === "object" || typeof lazyTarget === "function") { + return Reflect.get(lazyTarget, p, receiver); + } + throw new Error("proxyLazy called on a primitive value"); } }) as any; } From 3ecd2deae5002e32b31b795bef0fbc8a1d8b95bf Mon Sep 17 00:00:00 2001 From: AutumnVN Date: Tue, 9 Apr 2024 07:23:55 +0700 Subject: [PATCH 07/41] plugin settings: fix filter dropdown having no padding (#2332) --- src/components/PluginSettings/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index fe111fa9d..33a472c1a 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -315,7 +315,6 @@ export default function PluginSettings() {