mirror of
https://github.com/System-End/Vencord.git
synced 2026-04-19 22:05:11 +00:00
FixImagesQuality: fix not applying to embed images
This commit is contained in:
parent
5b7b033df7
commit
5d56820a5d
1 changed files with 6 additions and 3 deletions
|
|
@ -60,12 +60,15 @@ export default definePlugin({
|
|||
);
|
||||
},
|
||||
|
||||
getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; }, freeze?: boolean) {
|
||||
getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; mosaicStyleAlt?: boolean; }, freeze?: boolean) {
|
||||
if (!props?.src) return;
|
||||
|
||||
try {
|
||||
const { contentType, height, mediaLayoutType, src, width } = props;
|
||||
if (!contentType?.startsWith("image/") || src.startsWith("data:")) return;
|
||||
const { contentType, height, mediaLayoutType, src, width, mosaicStyleAlt } = props;
|
||||
// Embed images do not have a content type set.
|
||||
// It's difficult to differentiate between images and videos. but mosaicStyleAlt seems exclusive to images
|
||||
const isImage = contentType?.startsWith("image/") ?? (typeof mosaicStyleAlt === "boolean");
|
||||
if (!isImage || src.startsWith("data:")) return;
|
||||
|
||||
const url = new URL(src);
|
||||
if (!url.pathname.startsWith("/attachments/")) return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue