Update MSC reference

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
t3chguy/msc-is-animated
Michael Telatynski 2024-11-21 12:53:34 +00:00
parent ef1c7a1650
commit 5a09b081d7
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
3 changed files with 5 additions and 5 deletions

View File

@ -24,9 +24,9 @@ declare module "matrix-js-sdk/src/types" {
export interface ImageInfo {
/**
* @see https://github.com/matrix-org/matrix-spec-proposals/pull/XXXX
* @see https://github.com/matrix-org/matrix-spec-proposals/pull/4230
*/
"org.matrix.mscXXXX.is_animated"?: boolean;
"org.matrix.msc4230.is_animated"?: boolean;
}
export interface StateEvents {

View File

@ -159,7 +159,7 @@ async function infoForImageFile(matrixClient: MatrixClient, roomId: string, imag
const result = await createThumbnail(imageElement.img, imageElement.width, imageElement.height, thumbnailType);
const imageInfo = result.info;
imageInfo["org.matrix.mscXXXX.is_animated"] = await isAnimatedPromise;
imageInfo["org.matrix.msc4230.is_animated"] = await isAnimatedPromise;
// For lesser supported image types, always include the thumbnail even if it is larger
if (!ALWAYS_INCLUDE_THUMBNAIL.includes(imageFile.type)) {

View File

@ -275,7 +275,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
}
const content = this.props.mxEvent.getContent<ImageContent>();
let isAnimated = content.info?.["org.matrix.mscXXXX.is_animated"] ?? mayBeAnimated(content.info?.mimetype);
let isAnimated = content.info?.["org.matrix.msc4230.is_animated"] ?? mayBeAnimated(content.info?.mimetype);
// If there is no included non-animated thumbnail then we will generate our own, we can't depend on the server
// because 1. encryption and 2. we can't ask the server specifically for a non-animated thumbnail.
@ -300,7 +300,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
try {
const blob = await this.props.mediaEventHelper!.sourceBlob.value;
if (
content.info?.["org.matrix.mscXXXX.is_animated"] === false ||
content.info?.["org.matrix.msc4230.is_animated"] === false ||
!(await blobIsAnimated(content.info?.mimetype, blob))
) {
isAnimated = false;