Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen 2026-09-14 16:40:18 -04:00
commit 3a00853ca3
No known key found for this signature in database
4 changed files with 33 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{
"name": "equicord",
"private": "true",
"version": "1.15.5.0",
"version": "1.15.6.0",
"description": "The other cutest Discord client mod",
"homepage": "https://github.com/Equicord/Equicord#readme",
"bugs": {

View file

@ -432,6 +432,8 @@ export default definePlugin({
},
renderMessageAccessory(props) {
if (props.message.vencordEmbeddedBy) return null;
const buttons = [] as JSX.Element[];
const equicordSupport = isEquicordSupport(props.message.author.id);

View file

@ -46,6 +46,8 @@ const messageCache = new Map<string, {
fetched: boolean;
}>();
const getCacheKey = (channelId: string, messageId: string) => `${channelId}:${messageId}`;
const Embed = findComponentLazy(m => m.prototype?.renderSuppressButton);
const ChannelMessage = findComponentByCodeLazy("childrenExecutedCommand:", ".hideAccessories");
let AutoModEmbed: ComponentType<any> = () => null;
@ -127,17 +129,19 @@ const settings = definePluginSettings({
}
});
async function fetchMessage(channelID: string, messageID: string) {
const cached = messageCache.get(messageID);
async function fetchMessage(channelId: string, messageId: string) {
const cacheKey = getCacheKey(channelId, messageId);
const cached = messageCache.get(cacheKey);
if (cached) return cached.message;
messageCache.set(messageID, { fetched: false });
messageCache.set(cacheKey, { fetched: false });
const res = await RestAPI.get({
url: Constants.Endpoints.MESSAGES(channelID),
url: Constants.Endpoints.MESSAGES(channelId),
query: {
limit: 1,
around: messageID
around: messageId
},
retries: 2
}).catch(() => null);
@ -145,10 +149,12 @@ async function fetchMessage(channelID: string, messageID: string) {
const msg = res?.body?.[0];
if (!msg) return;
if (msg.id !== messageId) return;
const message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
if (!message) return;
messageCache.set(message.id, {
messageCache.set(cacheKey, {
message,
fetched: true
});
@ -227,31 +233,37 @@ function MessageEmbedAccessory({ message }: { message: Message; }) {
const accessories = [] as (JSX.Element | null)[];
for (const [_, channelID, messageID] of message.content!.matchAll(messageLinkRegex)) {
if (embeddedBy.includes(messageID) || embeddedBy.length > 2) {
const seen = new Set<string>();
let count = 0;
for (const [_, channelId, messageId] of message.content!.matchAll(messageLinkRegex)) {
if (embeddedBy.includes(messageId) || embeddedBy.length > 2 || seen.has(messageId) || count >= 5) {
continue;
}
const linkedChannel = ChannelStore.getChannel(channelID);
seen.add(messageId);
count++;
const linkedChannel = ChannelStore.getChannel(channelId);
if (!linkedChannel || (!linkedChannel.isPrivate() && !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, linkedChannel))) {
continue;
}
const { listMode, idList } = settings.store;
const isListed = [linkedChannel.guild_id, channelID, message.author.id].some(id => 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;
let linkedMessage = messageCache.get(messageID)?.message;
const cacheKey = getCacheKey(channelId, messageId);
let linkedMessage = messageCache.get(cacheKey)?.message;
if (!linkedMessage) {
linkedMessage ??= MessageStore.getMessage(channelID, messageID);
linkedMessage ??= MessageStore.getMessage(channelId, messageId);
if (linkedMessage) {
messageCache.set(messageID, { message: linkedMessage, fetched: true });
messageCache.set(cacheKey, { message: linkedMessage, fetched: true });
} else {
messageFetchQueue.unshift(() => fetchMessage(channelID, messageID)
messageFetchQueue.unshift(() => fetchMessage(channelId, messageId)
.then(m => m && updateMessage(message.channel_id, message.id))
);
continue;

View file

@ -689,6 +689,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
Davri: {
name: "Davri",
id: 457579346282938368n
},
Kaede: {
name: "Kaede",
id: 1492642701320126504n
}
} satisfies Record<string, Dev>);