commit 981d67b150afca02556354b510c28e9b75377b9f
parent 64ac64fabfcbbb1ae873c7659190adeb56824fe6
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 14 Jan 2022 14:55:12 +0100
Add encoding to metadata
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/pages/index.tsx b/pages/index.tsx
@@ -52,6 +52,7 @@ class Home extends PureComponent<Props, State>{
"author": event.content.displayname,
"name": image['m.text']
},
+ "encodingFormat": image['m.file'].mimetype,
// TODO get this from the event itself
"license": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"author": event.content.displayname,
@@ -71,6 +72,7 @@ class Home extends PureComponent<Props, State>{
"author": event.content.displayname,
"name": event.content['m.text']
},
+ "encodingFormat": event.content['m.file'].mimetype,
// TODO get this from the event itself
"license": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"author": event.content.displayname,
diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx
@@ -250,6 +250,7 @@ class Post extends PureComponent<Props, State> {
"author": imageEvent.content.displayname,
"name": imageEvent.content['m.text']
},
+ encodingFormat: imageEvent.content['m.file'].mimetype,
// TODO get this from the event itself
license: "https://creativecommons.org/licenses/by-nc-nd/4.0/",
author: this.state.displayname,
@@ -297,7 +298,7 @@ class Post extends PureComponent<Props, State> {
}
renderImageGalleryEvent(imageEvent: ImageGalleryEvent, caption: string) {
- const metadata: { "@context": string; "@type": string; contentUrl: string; license: string; author: string; name: string; thumbnail: any; }[] = [];
+ const metadata: { "@context": string; "@type": string; contentUrl: string; license: string; author: string; name: string; thumbnail: any; encodingFormat: string; }[] = [];
const images = imageEvent.content['m.image_gallery'].map(image => {
const url = this.context.client?.downloadLink(image["m.file"].url);
const thumbnail_url = this.context.client?.downloadLink(image['m.thumbnail'][0].url);
@@ -316,6 +317,7 @@ class Post extends PureComponent<Props, State> {
"author": imageEvent.content.displayname,
"name": image['m.text']
},
+ encodingFormat: image['m.file'].mimetype,
// TODO get this from the event itself
license: "https://creativecommons.org/licenses/by-nc-nd/4.0/",
author: this.state.displayname!,