+ {!!getCurrentChannel()?.guild_id && (
+
+ )}
{getCreatedAtDate(friendsSince, locale.getLocale())}
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");
+ }
});
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/noMosaic/index.ts b/src/plugins/noMosaic/index.ts
index 7f9fad53c..802f65e51 100644
--- a/src/plugins/noMosaic/index.ts
+++ b/src/plugins/noMosaic/index.ts
@@ -11,21 +11,15 @@ import definePlugin, { OptionType } from "@utils/types";
import style from "./styles.css?managed";
+const MAX_WIDTH = 550;
+const MAX_HEIGHT = 350;
+
const settings = definePluginSettings({
inlineVideo: {
description: "Play videos without carousel modal",
type: OptionType.BOOLEAN,
default: true,
restartNeeded: true
- },
- mediaLayoutType: {
- description: "Choose media layout type",
- type: OptionType.SELECT,
- restartNeeded: true,
- options: [
- { label: "STATIC, render loading image but image isn't resposive, no problem unless discord window width is too small", value: "STATIC", default: true },
- { label: "RESPONSIVE, image is responsive but not render loading image, cause messages shift when loaded", value: "RESPONSIVE" },
- ]
}
});
@@ -42,7 +36,7 @@ export default definePlugin({
find: ".oneByTwoLayoutThreeGrid",
replacement: [{
match: /mediaLayoutType:\i\.\i\.MOSAIC/,
- replace: "mediaLayoutType:$self.mediaLayoutType()",
+ replace: "mediaLayoutType:'RESPONSIVE'",
},
{
match: /null!==\(\i=\i\.get\(\i\)\)&&void 0!==\i\?\i:"INVALID"/,
@@ -59,15 +53,43 @@ export default definePlugin({
},
{
find: "Messages.REMOVE_ATTACHMENT_TOOLTIP_TEXT",
- replacement: {
+ replacement: [{
match: /\i===\i\.\i\.MOSAIC/,
replace: "true"
+ },
+ {
+ match: /\i!==\i\.\i\.MOSAIC/,
+ replace: "false"
+ }]
+ },
+ {
+ find: ".messageAttachment,",
+ replacement: {
+ match: /\{width:\i,height:\i\}=(\i).*?(?=className:\i\(\)\(\i\.messageAttachment,)/,
+ replace: "$&style:$self.style($1),"
}
}
],
- mediaLayoutType() {
- return settings.store.mediaLayoutType;
+ style({ width, height }) {
+ if (!width || !height) return {};
+
+ if (width > MAX_WIDTH || height > MAX_HEIGHT) {
+ if (width / height > MAX_WIDTH / MAX_HEIGHT) {
+ height = Math.ceil(MAX_WIDTH / (width / height));
+ width = MAX_WIDTH;
+ } else {
+ width = Math.ceil(MAX_HEIGHT * (width / height));
+ height = MAX_HEIGHT;
+ }
+ }
+
+ return {
+ maxWidth: width,
+ width: "100%",
+ aspectRatio: `${width} / ${height}`
+ };
+
},
start() {
diff --git a/src/plugins/noMosaic/styles.css b/src/plugins/noMosaic/styles.css
index 05ea24899..3a8a8e464 100644
--- a/src/plugins/noMosaic/styles.css
+++ b/src/plugins/noMosaic/styles.css
@@ -1,3 +1,8 @@
[class^="nonMediaAttachmentsContainer_"] [class*="messageAttachment_"] {
position: relative;
}
+
+[class^="nonMediaAttachmentsContainer_"],
+[class^="nonMediaAttachmentItem_"]:has([class^="messageAttachment_"][style^="max-width"]) {
+ width: 100%;
+}
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) {
diff --git a/src/plugins/pronoundb/index.ts b/src/plugins/pronoundb/index.ts
index b1e74158b..61edd191e 100644
--- a/src/plugins/pronoundb/index.ts
+++ b/src/plugins/pronoundb/index.ts
@@ -36,25 +36,24 @@ export default definePlugin({
authors: [Devs.Tyman, Devs.TheKodeToad, Devs.Ven],
description: "Adds pronouns to user messages using pronoundb",
patches: [
- // Add next to username (compact mode)
{
find: "showCommunicationDisabledStyles",
- replacement: {
- match: /("span",{id:\i,className:\i,children:\i}\))/,
- replace: "$1, $self.CompactPronounsChatComponentWrapper(arguments[0])"
- }
- },
- // Patch the chat timestamp element (normal mode)
- {
- find: "showCommunicationDisabledStyles",
- replacement: {
- match: /(?<=return\s*\(0,\i\.jsxs?\)\(.+!\i&&)(\(0,\i.jsxs?\)\(.+?\{.+?\}\))/,
- replace: "[$1, $self.PronounsChatComponentWrapper(arguments[0])]"
- }
+ replacement: [
+ // Add next to username (compact mode)
+ {
+ match: /("span",{id:\i,className:\i,children:\i}\))/,
+ replace: "$1, $self.CompactPronounsChatComponentWrapper(arguments[0])"
+ },
+ // Patch the chat timestamp element (normal mode)
+ {
+ match: /(?<=return\s*\(0,\i\.jsxs?\)\(.+!\i&&)(\(0,\i.jsxs?\)\(.+?\{.+?\}\))/,
+ replace: "[$1, $self.PronounsChatComponentWrapper(arguments[0])]"
+ }
+ ]
},
// Patch the profile popout username header to use our pronoun hook instead of Discord's pronouns
{
- find: ".userTagNoNickname",
+ find: ".pronouns,children",
replacement: [
{
match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i;/,
diff --git a/src/plugins/resurrectHome/index.tsx b/src/plugins/resurrectHome/index.tsx
index f48debc76..980629126 100644
--- a/src/plugins/resurrectHome/index.tsx
+++ b/src/plugins/resurrectHome/index.tsx
@@ -18,9 +18,68 @@
import { findGroupChildrenByChildId } from "@api/ContextMenu";
import { definePluginSettings } from "@api/Settings";
+import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
-import { Menu } from "@webpack/common";
+import { findByPropsLazy } from "@webpack";
+import { Button, Menu, Tooltip, useEffect, useState } from "@webpack/common";
+
+const ChannelRowClasses = findByPropsLazy("modeConnected", "modeLocked", "icon");
+
+let currentShouldViewServerHome = false;
+const shouldViewServerHomeStates = new Set
>>();
+
+function ViewServerHomeButton() {
+ return (
+
+ {tooltipProps => (
+
+ )}
+
+ );
+}
+
+function useForceServerHome() {
+ const { forceServerHome } = settings.use(["forceServerHome"]);
+ const [shouldViewServerHome, setShouldViewServerHome] = useState(currentShouldViewServerHome);
+
+ useEffect(() => {
+ shouldViewServerHomeStates.add(setShouldViewServerHome);
+
+ return () => {
+ shouldViewServerHomeStates.delete(setShouldViewServerHome);
+ };
+ }, []);
+
+ return shouldViewServerHome || forceServerHome;
+}
+
+function useDisableViewServerHome() {
+ useEffect(() => () => {
+ currentShouldViewServerHome = false;
+ for (const setState of shouldViewServerHomeStates) {
+ setState(false);
+ }
+ }, []);
+}
const settings = definePluginSettings({
forceServerHome: {
@@ -30,12 +89,6 @@ const settings = definePluginSettings({
}
});
-function useForceServerHome() {
- const { forceServerHome } = settings.use(["forceServerHome"]);
-
- return forceServerHome;
-}
-
export default definePlugin({
name: "ResurrectHome",
description: "Re-enables the Server Home tab when there isn't a Server Guide. Also has an option to force the Server Home over the Server Guide, which is accessible through right-clicking the Server Guide.",
@@ -89,17 +142,40 @@ 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()`
+ }
+ },
+ // Add View Server Home Button to Server Guide
+ {
+ find: "487e85_1",
+ replacement: {
+ match: /(?<=text:(\i)\?\i\.\i\.Messages\.SERVER_GUIDE:\i\.\i\.Messages\.GUILD_HOME,)/,
+ replace: "badge:$self.ViewServerHomeButton({serverGuide:$1}),"
+ }
+ },
+ // Disable view Server Home override when the Server Home is unmouted
+ {
+ find: "69386d_5",
+ replacement: {
+ match: /location:"69386d_5".+?;/,
+ replace: "$&$self.useDisableViewServerHome();"
}
}
],
+ ViewServerHomeButton: ErrorBoundary.wrap(({ serverGuide }: { serverGuide?: boolean; }) => {
+ if (serverGuide !== true) return null;
+
+ return ;
+ }),
+
useForceServerHome,
+ useDisableViewServerHome,
contextMenus: {
"guild-context"(children, props) {
- const forceServerHome = useForceServerHome();
+ const { forceServerHome } = settings.use(["forceServerHome"]);
if (!props?.guild) return;
diff --git a/src/plugins/reviewDB/settings.tsx b/src/plugins/reviewDB/settings.tsx
index 79cf4174e..eeebd0aa1 100644
--- a/src/plugins/reviewDB/settings.tsx
+++ b/src/plugins/reviewDB/settings.tsx
@@ -71,7 +71,7 @@ export const settings = definePluginSettings({