diff --git a/package.json b/package.json
index 08078d3d5..5ffac7ff5 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
- "version": "1.6.8",
+ "version": "1.6.9",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
diff --git a/src/api/Notifications/notificationLog.tsx b/src/api/Notifications/notificationLog.tsx
index 9535fb62c..6f79ef70a 100644
--- a/src/api/Notifications/notificationLog.tsx
+++ b/src/api/Notifications/notificationLog.tsx
@@ -21,7 +21,7 @@ import { Settings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { useAwaiter } from "@utils/react";
-import { Alerts, Button, Forms, moment, React, Text, Timestamp, useEffect, useReducer, useState } from "@webpack/common";
+import { Alerts, Button, Forms, React, Text, Timestamp, useEffect, useReducer, useState } from "@webpack/common";
import { nanoid } from "nanoid";
import type { DispatchWithoutAction } from "react";
@@ -129,7 +129,7 @@ function NotificationEntry({ data }: { data: PersistentNotificationData; }) {
richBody={
{data.body}
-
+
}
/>
diff --git a/src/plugins/crashHandler/index.ts b/src/plugins/crashHandler/index.ts
index b73641f57..f8c76d7f7 100644
--- a/src/plugins/crashHandler/index.ts
+++ b/src/plugins/crashHandler/index.ts
@@ -57,6 +57,7 @@ const settings = definePluginSettings({
});
let hasCrashedOnce = false;
+let isRecovering = false;
let shouldAttemptRecover = true;
export default definePlugin({
@@ -71,38 +72,49 @@ export default definePlugin({
{
find: ".Messages.ERRORS_UNEXPECTED_CRASH",
replacement: {
- match: /(?=this\.setState\()/,
- replace: "$self.handleCrash(this);"
+ match: /this\.setState\((.+?)\)/,
+ replace: "$self.handleCrash(this,$1);"
}
}
],
- handleCrash(_this: any) {
+ handleCrash(_this: any, errorState: any) {
+ _this.setState(errorState);
+
+ // Already recovering, prevent error which happens more than once too fast to trigger another recover
+ if (isRecovering) return;
+ isRecovering = true;
+
// 1 ms timeout to avoid react breaking when re-rendering
setTimeout(() => {
- if (!shouldAttemptRecover) {
- try {
- showNotification({
- color: "#eed202",
- title: "Discord has crashed!",
- body: "Awn :( Discord has crashed two times rapidly, not attempting to recover.",
- noPersist: true,
- });
- } catch { }
+ try {
+ // Prevent a crash loop with an error that could not be handled
+ if (!shouldAttemptRecover) {
+ try {
+ showNotification({
+ color: "#eed202",
+ title: "Discord has crashed!",
+ body: "Awn :( Discord has crashed two times rapidly, not attempting to recover.",
+ noPersist: true
+ });
+ } catch { }
- return;
- }
+ return;
+ }
- shouldAttemptRecover = false;
- // This is enough to avoid a crash loop
- setTimeout(() => shouldAttemptRecover = true, 500);
+ shouldAttemptRecover = false;
+ // This is enough to avoid a crash loop
+ setTimeout(() => shouldAttemptRecover = true, 500);
+ } catch { }
try {
if (!hasCrashedOnce) {
hasCrashedOnce = true;
maybePromptToUpdate("Uh oh, Discord has just crashed... but good news, there is a Vencord update available that might fix this issue! Would you like to update now?", true);
}
+ } catch { }
+ try {
if (settings.store.attemptToPreventCrashes) {
this.handlePreventCrash(_this);
}
@@ -118,7 +130,7 @@ export default definePlugin({
color: "#eed202",
title: "Discord has crashed!",
body: "Attempting to recover...",
- noPersist: true,
+ noPersist: true
});
} catch { }
@@ -169,6 +181,10 @@ export default definePlugin({
}
}
+
+ // Set isRecovering to false before setting the state to allow us to handle the next crash error correcty, in case it happens
+ setImmediate(() => isRecovering = false);
+
try {
_this.setState({ error: null, info: null });
} catch (err) {
diff --git a/src/plugins/fakeNitro/index.ts b/src/plugins/fakeNitro/index.ts
index ed3ec59dd..560cae381 100644
--- a/src/plugins/fakeNitro/index.ts
+++ b/src/plugins/fakeNitro/index.ts
@@ -838,7 +838,7 @@ export default definePlugin({
url.searchParams.set("name", emoji.name);
messageObj.content = messageObj.content.replace(emojiString, (match, offset, origStr) => {
- return `${getWordBoundary(origStr, offset - 1)}${s.useHyperLinks ? `[:${emoji.name}:](${url})` : url}${getWordBoundary(origStr, offset + match.length)}`;
+ return `${getWordBoundary(origStr, offset - 1)}${s.useHyperLinks ? `[${emoji.name}](${url})` : url}${getWordBoundary(origStr, offset + match.length)}`;
});
}
}
@@ -864,7 +864,7 @@ export default definePlugin({
url.searchParams.set("size", s.emojiSize.toString());
url.searchParams.set("name", emoji.name);
- return `${getWordBoundary(origStr, offset - 1)}${s.useHyperLinks ? `[:${emoji.name}:](${url})` : url}${getWordBoundary(origStr, offset + emojiStr.length)}`;
+ return `${getWordBoundary(origStr, offset - 1)}${s.useHyperLinks ? `[${emoji.name}](${url})` : url}${getWordBoundary(origStr, offset + emojiStr.length)}`;
});
});
},
diff --git a/src/plugins/imageZoom/components/Magnifier.tsx b/src/plugins/imageZoom/components/Magnifier.tsx
index 6a3fc05a0..816717350 100644
--- a/src/plugins/imageZoom/components/Magnifier.tsx
+++ b/src/plugins/imageZoom/components/Magnifier.tsx
@@ -123,14 +123,13 @@ export const Magnifier: React.FC = ({ instance, size: initialSiz
waitFor(() => instance.state.readyState === "READY", () => {
const elem = document.getElementById(ELEMENT_ID) as HTMLDivElement;
element.current = elem;
- elem.firstElementChild!.setAttribute("draggable", "false");
+ elem.querySelector("img,video")?.setAttribute("draggable", "false");
if (instance.props.animated) {
originalVideoElementRef.current = elem!.querySelector("video")!;
originalVideoElementRef.current.addEventListener("timeupdate", syncVideos);
- setReady(true);
- } else {
- setReady(true);
}
+
+ setReady(true);
});
document.addEventListener("keydown", onKeyDown);
document.addEventListener("keyup", onKeyUp);
@@ -155,7 +154,9 @@ export const Magnifier: React.FC = ({ instance, size: initialSiz
if (!ready) return null;
- const box = element.current!.getBoundingClientRect();
+ const box = element.current?.getBoundingClientRect();
+
+ if (!box) return null;
return (
id && idList.includes(id));
+ const isListed = [linkedChannel.guild_id, channelID, message.author.id].some(id => id && idList.includes(id));
if (listMode === "blacklist" && isListed) continue;
if (listMode === "whitelist" && !isListed) continue;
@@ -265,8 +267,7 @@ function MessageEmbedAccessory({ message }: { message: Message; }) {
const messageProps: MessageEmbedProps = {
message: withEmbeddedBy(linkedMessage, [...embeddedBy, message.id]),
- channel: linkedChannel,
- guildID
+ channel: linkedChannel
};
const type = settings.store.automodEmbeds;
@@ -280,59 +281,64 @@ function MessageEmbedAccessory({ message }: { message: Message; }) {
return accessories.length ? <>{accessories}> : null;
}
-function ChannelMessageEmbedAccessory({ message, channel, guildID }: MessageEmbedProps): JSX.Element | null {
- const isDM = guildID === "@me";
+function getChannelLabelAndIconUrl(channel: Channel) {
+ if (channel.isDM()) return ["Direct Message", IconUtils.getUserAvatarURL(UserStore.getUser(channel.recipients[0]))];
+ if (channel.isGroupDM()) return ["Group DM", IconUtils.getChannelIconURL(channel)];
+ return ["Server", IconUtils.getGuildIconURL(GuildStore.getGuild(channel.guild_id))];
+}
- const guild = !isDM && GuildStore.getGuild(channel.guild_id);
+function ChannelMessageEmbedAccessory({ message, channel }: MessageEmbedProps): JSX.Element | null {
const dmReceiver = UserStore.getUser(ChannelStore.getChannel(channel.id).recipients?.[0]);
+ const [channelLabel, iconUrl] = getChannelLabelAndIconUrl(channel);
- return