mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
feat: GIF and Video embed support
This commit is contained in:
@@ -89,6 +89,20 @@ export default function Embed({ embed }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { width, height } = calculateSize(mw, mh);
|
const { width, height } = calculateSize(mw, mh);
|
||||||
|
if (embed.type === "Website" && embed.special?.type === "GIF") {
|
||||||
|
return (
|
||||||
|
<EmbedMedia
|
||||||
|
embed={embed}
|
||||||
|
width={
|
||||||
|
height *
|
||||||
|
((embed.image?.width ?? 0) /
|
||||||
|
(embed.image?.height ?? 0))
|
||||||
|
}
|
||||||
|
height={height}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.embed, styles.website)}
|
className={classNames(styles.embed, styles.website)}
|
||||||
@@ -181,6 +195,18 @@ export default function Embed({ embed }: Props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
case "Video": {
|
||||||
|
return (
|
||||||
|
<video
|
||||||
|
className={classNames(styles.embed, styles.image)}
|
||||||
|
style={calculateSize(embed.width, embed.height)}
|
||||||
|
src={client.proxyFile(embed.url)}
|
||||||
|
frameBorder="0"
|
||||||
|
loading="lazy"
|
||||||
|
controls
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user