From 36bad0c31f6fb1afce2d311b72f5f9661be6af97 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Wed, 15 Jul 2020 18:36:51 -0400 Subject: [PATCH] FIX: Preload metadata for audio/video when secure media enabled Fixes an issue with missing video previews. Should have no side effects now that presigned URLs expire after 5 minutes. --- .../addon/engines/discourse-markdown-it.js | 15 +++------ test/javascripts/lib/pretty-text-test.js | 31 ++----------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js index 358595d2485..5e7ef24c2ac 100644 --- a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js +++ b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js @@ -144,23 +144,21 @@ export function extractDataAttribute(str) { function videoHTML(token, opts) { const src = token.attrGet("src"); const origSrc = token.attrGet("data-orig-src"); - const preloadType = opts.secureMedia ? "none" : "metadata"; const dataOrigSrcAttr = origSrc !== null ? `data-orig-src="${origSrc}"` : ""; return `

${opts.alt}

-
`; } -function audioHTML(token, opts) { +function audioHTML(token) { const src = token.attrGet("src"); const origSrc = token.attrGet("data-orig-src"); - const preloadType = opts.secureMedia ? "none" : "metadata"; const dataOrigSrcAttr = origSrc !== null ? `data-orig-src="${origSrc}"` : ""; - return `