From e2cd3a52995eecfce4ba0f877795633ffad2667e Mon Sep 17 00:00:00 2001 From: Bruno Viveiros Date: Tue, 22 Aug 2023 09:33:26 -0300 Subject: [PATCH] fix: add provider_name check to card iframes --- app/javascript/mastodon/features/status/components/card.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/mastodon/features/status/components/card.jsx b/app/javascript/mastodon/features/status/components/card.jsx index 38ad5b72cb..9dad058e5c 100644 --- a/app/javascript/mastodon/features/status/components/card.jsx +++ b/app/javascript/mastodon/features/status/components/card.jsx @@ -35,7 +35,7 @@ const getHostname = url => { const domParser = new DOMParser(); -const handleIframeUrl = (html, url) => { +const handleIframeUrl = (html, url, providerName) => { const document = domParser.parseFromString(html, 'text/html').documentElement; const iframe = document.querySelector('iframe'); const startTime = new URL(url).searchParams.get('t') @@ -46,7 +46,7 @@ const handleIframeUrl = (html, url) => { iframeUrl.searchParams.set('autoplay', 1) iframeUrl.searchParams.set('auto_play', 1) - if (startTime) iframeUrl.searchParams.set('start', startTime) + if (startTime && providerName === "YouTube") iframeUrl.searchParams.set('start', startTime) iframe.src = iframeUrl.href @@ -110,7 +110,7 @@ export default class Card extends PureComponent { renderVideo () { const { card } = this.props; - const content = { __html: handleIframeUrl(card.get('html'), card.get('url')) }; + const content = { __html: handleIframeUrl(card.get('html'), card.get('url'), card.get('provider_name')) }; return (