Add more thumbnails for more mimetypes that we don't generate thumbanils for (wav, zip, things like that)
This commit is contained in:
parent
23169e0533
commit
b8aab0c258
15
script.js
15
script.js
|
@ -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`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue