mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Update MLEnhanced
This commit is contained in:
parent
00760172ef
commit
c1f079bc6c
5 changed files with 4 additions and 11 deletions
|
@ -400,4 +400,3 @@ export default definePlugin({
|
||||||
MessageStore.getMessage = this.oldGetMessage;
|
MessageStore.getMessage = this.oldGetMessage;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -164,8 +164,8 @@ export async function downloadAttachment(_event: IpcMainInvokeEvent, attachemnt:
|
||||||
const res = await fetch(useOldUrl ? attachemnt.oldUrl : attachemnt.url);
|
const res = await fetch(useOldUrl ? attachemnt.oldUrl : attachemnt.url);
|
||||||
|
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
if (res.status === 404 || res.status === 403)
|
if (res.status === 404 || res.status === 403 || res.status === 415)
|
||||||
return { error: `Failed to get attachment ${attachemnt.id} for caching, error code ${res.status}`, path: null };
|
useOldUrl = true;
|
||||||
|
|
||||||
attempts++;
|
attempts++;
|
||||||
if (attempts > 3) {
|
if (attempts > 3) {
|
||||||
|
@ -176,7 +176,7 @@ export async function downloadAttachment(_event: IpcMainInvokeEvent, attachemnt:
|
||||||
}
|
}
|
||||||
|
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
return downloadAttachment(_event, attachemnt, attempts, res.status === 415);
|
return downloadAttachment(_event, attachemnt, attempts, useOldUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ab = await res.arrayBuffer();
|
const ab = await res.arrayBuffer();
|
||||||
|
|
|
@ -47,4 +47,3 @@ async function getSettingsFilePath() {
|
||||||
|
|
||||||
return mlSettingsDir;
|
return mlSettingsDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.",
|
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: {
|
ignoreBots: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to ignore messages by bots",
|
description: "Whether to ignore messages by bots",
|
||||||
|
|
|
@ -91,6 +91,7 @@ const getTimestamp = (timestamp: any): Date => {
|
||||||
export const mapTimestamp = (m: any) => {
|
export const mapTimestamp = (m: any) => {
|
||||||
if (m.timestamp) m.timestamp = getTimestamp(m.timestamp);
|
if (m.timestamp) m.timestamp = getTimestamp(m.timestamp);
|
||||||
if (m.editedTimestamp) m.editedTimestamp = getTimestamp(m.editedTimestamp);
|
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;
|
return m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue