Add more thumbnails for more mimetypes that we don't generate thumbanils for (wav, zip, things like that)

This commit is contained in:
towards-a-new-leftypol 2024-02-03 19:53:06 -05:00
parent 23169e0533
commit b8aab0c258
8 changed files with 13 additions and 2 deletions

BIN
7z.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
flv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
htm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
mp3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -500,6 +500,17 @@ function caught(m, e) {
alert(new Error(m + e.message)); alert(new Error(m + e.message));
}; };
const MIME_THUMBNAILS = {
'audio/opus': '/static/mpg.png',
'audio/ogg': '/static/mpg.png',
'audio/wav': '/static/wav.png',
'audio/x-wav': '/static/wav.png',
'audio/mpeg': '/static/mpg.png',
'application/zip': '/static/zip.png',
'text/plain': '/static/txt.png',
'application/x-7z-compressed' : '/static/7z.png'
};
function mkSpamImgElement(img_description) { function mkSpamImgElement(img_description) {
var img_elem = document.createElement('img'); var img_elem = document.createElement('img');
var mime = img_description.mimetype; var mime = img_description.mimetype;
@ -510,8 +521,8 @@ function mkSpamImgElement(img_description) {
if (illegal) { if (illegal) {
thumb_url = "/static/redacted.jpg"; thumb_url = "/static/redacted.jpg";
} else if (mime == "audio/mpeg") { } else if (MIME_THUMBNAILS[mime] != null) {
thumb_url = '/static/mpg.png'; thumb_url = MIME_THUMBNAILS[mime];
} else { } else {
thumb_url = `/bin/?path=${img_description.md5_hash}_thumbnail.jpg&mimetype=image/jpeg` thumb_url = `/bin/?path=${img_description.md5_hash}_thumbnail.jpg&mimetype=image/jpeg`
} }

BIN
txt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
wav.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
zip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB