diff --git a/client/views/msg_preview.tpl b/client/views/msg_preview.tpl index 3f7f2d10..7f09bc5c 100644 --- a/client/views/msg_preview.tpl +++ b/client/views/msg_preview.tpl @@ -4,23 +4,29 @@ - {{else}} - {{#equal type "audio"}} - - {{else}} - {{#if thumb}} - - - - {{/if}} - -
{{head}}
-
{{body}}
+ {{/equal}} + {{#equal type "audio"}} + + {{/equal}} + {{#equal type "video"}} + + {{/equal}} + {{#equal type "link"}} + {{#if thumb}} +
+ - {{/equal}} + {{/if}} + +
{{head}}
+
{{body}}
+
{{/equal}} {{/preview}} diff --git a/src/plugins/irc-events/link.js b/src/plugins/irc-events/link.js index cd3ea0d9..45acaf84 100644 --- a/src/plugins/irc-events/link.js +++ b/src/plugins/irc-events/link.js @@ -120,6 +120,18 @@ function parse(msg, preview, res, client) { } preview.type = "audio"; preview.res = res.type; + + break; + + case "video/webm": + case "video/ogg": + case "video/mp4": + if (!preview.link.startsWith("https://")) { + break; + } + preview.res = res.type; + preview.type = "video"; + break; default: @@ -186,7 +198,7 @@ function fetch(uri, cb) { if (contentLength > limit) { req.abort(); } - } else if (/^audio\/.+/.test(res.headers["content-type"])) { + } else if (/^(audio|video)\/.+/.test(res.headers["content-type"])) { req.abort(); // ensure server doesn't download the audio file } else { // if not image, limit download to 50kb, since we need only meta tags