diff --git a/7z.png b/7z.png new file mode 100644 index 0000000..4b1a5fd Binary files /dev/null and b/7z.png differ diff --git a/flv.png b/flv.png new file mode 100644 index 0000000..1dd71aa Binary files /dev/null and b/flv.png differ diff --git a/htm.png b/htm.png new file mode 100644 index 0000000..56cee15 Binary files /dev/null and b/htm.png differ diff --git a/mp3.png b/mp3.png new file mode 100644 index 0000000..16d4ffb Binary files /dev/null and b/mp3.png differ diff --git a/script.js b/script.js index 006940e..b93d935 100644 --- a/script.js +++ b/script.js @@ -500,6 +500,17 @@ function caught(m, e) { 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) { var img_elem = document.createElement('img'); var mime = img_description.mimetype; @@ -510,8 +521,8 @@ function mkSpamImgElement(img_description) { if (illegal) { thumb_url = "/static/redacted.jpg"; - } else if (mime == "audio/mpeg") { - thumb_url = '/static/mpg.png'; + } else if (MIME_THUMBNAILS[mime] != null) { + thumb_url = MIME_THUMBNAILS[mime]; } else { thumb_url = `/bin/?path=${img_description.md5_hash}_thumbnail.jpg&mimetype=image/jpeg` } diff --git a/txt.png b/txt.png new file mode 100644 index 0000000..5289602 Binary files /dev/null and b/txt.png differ diff --git a/wav.png b/wav.png new file mode 100644 index 0000000..e5ae8f3 Binary files /dev/null and b/wav.png differ diff --git a/zip.png b/zip.png new file mode 100644 index 0000000..8ca2bfa Binary files /dev/null and b/zip.png differ