From 94748d483db96ecda4966d4cf172ecc7a6491e54 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 1 Oct 2024 11:18:23 -0400 Subject: [PATCH 1/4] validators: allow application/octet-stream video as MP4s --- lib/plugins/validators/async/21_checkContentType.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/plugins/validators/async/21_checkContentType.js b/lib/plugins/validators/async/21_checkContentType.js index dfc308cef..4a08a66f8 100644 --- a/lib/plugins/validators/async/21_checkContentType.js +++ b/lib/plugins/validators/async/21_checkContentType.js @@ -107,6 +107,16 @@ export default { link.error = 'Adobe Flash Player is no longer supported'; } + if (data.type?.toLowerCase() == 'application/octet-stream' + && link.rel?.indexOf(CONFIG.R.player) > -1 + && link.accept && link.accept instanceof Array + && link.accept.indexOf('video/*') > -1) { + data.type = CONFIG.T.video_mp4; + if (!link.message) { + link.message = 'Showing application/octet-stream as MP4'; + } + } + /** accept-ranges is misconfigured in many cases (especially via CloudFront). Plus, browsers would try and download first range of MP4 file anyway, even if the header isn't set if (data.type == CONFIG.T.video_mp4 && !/bytes/i.test(data.accept_ranges)) { link.error = 'MP4s should allow partial download via accept ranges'; From ad4591538178f87e0b93c54e269bd5e0777d9632 Mon Sep 17 00:00:00 2001 From: LiFaytheGoblin Date: Tue, 1 Oct 2024 11:22:27 +0200 Subject: [PATCH 2/4] adds missing comma in config.local.js.SAMPLE --- config.local.js.SAMPLE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.local.js.SAMPLE b/config.local.js.SAMPLE index 4d2d7761f..72bb99a27 100644 --- a/config.local.js.SAMPLE +++ b/config.local.js.SAMPLE @@ -256,7 +256,7 @@ export default { youtube: { // api_key: "INSERT YOUR VALUE", // parts: [ "snippet", "player" ], // list of fields you want to use in the request, in most cases you only need those two - get_params: "?rel=0&showinfo=1" // https://developers.google.com/youtube/player_parameters, + get_params: "?rel=0&showinfo=1", // https://developers.google.com/youtube/player_parameters, fix_shorts_in_eu: true // Avoid consent redirect for EU servers }, vimeo: { From bab08d082858160adffa1a176d03489944c5b176 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 2 Oct 2024 11:09:18 -0400 Subject: [PATCH 3/4] domains: fix private Soundclouds (#560) by adding required oEmbed iframe `assignQuerystring` method that is used in main Soundcloud plugin --- lib/plugins/system/oembed/oembed.js | 83 +++++++++++-------- .../soundcloud.com/soundcloud-oembed-error.js | 13 +-- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/lib/plugins/system/oembed/oembed.js b/lib/plugins/system/oembed/oembed.js index d33470d9c..353183639 100644 --- a/lib/plugins/system/oembed/oembed.js +++ b/lib/plugins/system/oembed/oembed.js @@ -31,51 +31,60 @@ function fixOembedIframeAttributes(obj) { } function _getOembedIframe(oembed) { - if (!oembed.html) { - return null; - } + if (typeof oembed._iframe === 'undefined') { - // Allow encoded entities if they start from $lt; - var html = oembed.html5 || oembed.html; - if (/^<$/i.test(html)) { - html = entities.decodeHTML(html); - } + var _iframe = null; + + if (oembed.html5 || oembed.html) { + + // Allow encoded entities if they start from $lt; + var html = oembed.html5 || oembed.html; + if (/^<$/i.test(html)) { + html = entities.decodeHTML(html); + } + + var $container = cheerio('
'); + try { + $container.html(html); + } catch (ex) {} + var $iframe = $container.find('iframe'); + + if ($iframe.length === 2 && /