Update MLEnhanced

This commit is contained in:
thororen1234 2025-01-05 09:34:58 -05:00
parent 00760172ef
commit c1f079bc6c
5 changed files with 4 additions and 11 deletions

View file

@ -400,4 +400,3 @@ export default definePlugin({
MessageStore.getMessage = this.oldGetMessage;
}
});

View file

@ -164,8 +164,8 @@ export async function downloadAttachment(_event: IpcMainInvokeEvent, attachemnt:
const res = await fetch(useOldUrl ? attachemnt.oldUrl : attachemnt.url);
if (res.status !== 200) {
if (res.status === 404 || res.status === 403)
return { error: `Failed to get attachment ${attachemnt.id} for caching, error code ${res.status}`, path: null };
if (res.status === 404 || res.status === 403 || res.status === 415)
useOldUrl = true;
attempts++;
if (attempts > 3) {
@ -176,7 +176,7 @@ export async function downloadAttachment(_event: IpcMainInvokeEvent, attachemnt:
}
await sleep(1000);
return downloadAttachment(_event, attachemnt, attempts, res.status === 415);
return downloadAttachment(_event, attachemnt, attempts, useOldUrl);
}
const ab = await res.arrayBuffer();

View file

@ -47,4 +47,3 @@ async function getSettingsFilePath() {
return mlSettingsDir;
}

View file

@ -42,12 +42,6 @@ export const settings = definePluginSettings({
description: "Usually message logger only logs from whitelisted ids and dms, enabling this would mean it would log messages from all servers as well. Note that this may cause the cache to exceed its limit, resulting in some messages being missed. If you are in a lot of servers, this may significantly increase the chances of messages being logged, which can result in a large message record and the inclusion of irrelevant messages.",
},
autoCheckForUpdates: {
default: true,
type: OptionType.BOOLEAN,
description: "Automatically check for updates on startup.",
},
ignoreBots: {
type: OptionType.BOOLEAN,
description: "Whether to ignore messages by bots",

View file

@ -91,6 +91,7 @@ const getTimestamp = (timestamp: any): Date => {
export const mapTimestamp = (m: any) => {
if (m.timestamp) m.timestamp = getTimestamp(m.timestamp);
if (m.editedTimestamp) m.editedTimestamp = getTimestamp(m.editedTimestamp);
if (m.embeds) m.embeds = m.embeds.map(e => sanitizeEmbed(m.channel_id, m.id, e));
return m;
};