feat(memberListActivities): option to disable rendering GIFs

This commit is contained in:
D3SOX 2024-02-16 09:15:13 +01:00
parent 11a1c81916
commit 96c1d9cb4b
No known key found for this signature in database
GPG key ID: 39EC1673FC37B048

View file

@ -36,6 +36,12 @@ const settings = definePluginSettings({
default: 20, default: 20,
stickToMarkers: false, stickToMarkers: false,
}, },
renderGifs: {
type: OptionType.BOOLEAN,
description: "Allow rendering GIFs",
default: true,
restartNeeded: false,
},
}); });
interface Activity { interface Activity {
@ -125,7 +131,9 @@ export default definePlugin({
const addImage = (image: string, alt: string) => { const addImage = (image: string, alt: string) => {
if (image.startsWith("mp:")) { if (image.startsWith("mp:")) {
const discordMediaLink = `https://media.discordapp.net/${image.replace(/mp:/, "")}`; const discordMediaLink = `https://media.discordapp.net/${image.replace(/mp:/, "")}`;
icons.push(<img src={discordMediaLink} alt={alt}/>); if (settings.store.renderGifs || !discordMediaLink.endsWith(".gif")) {
icons.push(<img src={discordMediaLink} alt={alt}/>);
}
} else { } else {
const src = `https://cdn.discordapp.com/app-assets/${application_id}/${image}.png`; const src = `https://cdn.discordapp.com/app-assets/${application_id}/${image}.png`;
icons.push(<img src={src} alt={alt}/>); icons.push(<img src={src} alt={alt}/>);