Add maxSizeAutoDownloads with default set to 10Mb

This commit is contained in:
N-Pex 2023-12-04 15:28:03 +01:00
parent 324ccd70b3
commit db517fbd9c
9 changed files with 12 additions and 8 deletions

View file

@ -130,7 +130,7 @@ class Util {
});
}
getThumbnail(matrixClient, event, ignoredw, ignoredh) {
getThumbnail(matrixClient, event, config, ignoredw, ignoredh) {
return new Promise((resolve, reject) => {
const content = event.getContent();
if (content.url != null) {
@ -160,7 +160,7 @@ class Util {
// true
// );
url = matrixClient.mxcUrlToHttp(file.url);
} else if (content.file && content.file.url && this.getMimeType(event).startsWith("image/")) {
} else if (content.file && content.file.url && this.getFileSize(event) > 0 && this.getFileSize(event) < config.maxSizeAutoDownloads) {
// No thumb, use real url
file = content.file;
url = matrixClient.mxcUrlToHttp(file.url);