fix(route): add youtube referer (#20396)
This commit is contained in:
@@ -5,6 +5,6 @@
|
||||
{{ set video = "https://www.youtube-nocookie.com/embed/" + video }}
|
||||
{{ /if }}
|
||||
|
||||
<iframe width="672" height="377" src="{{ video }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="672" height="377" src="{{ video }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{@ article.credits }}
|
||||
{{@ article.description }}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<figcaption>{{@ $value.caption }}</figcaption>
|
||||
</figure>
|
||||
{{ else if $value.type === 'YouTube' }}
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ $value.externalId }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ $value.externalId }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ if $value.caption }}{{@ $value.caption }}{{ /if }}
|
||||
{{ /if }}
|
||||
{{ /each }}
|
||||
|
||||
@@ -247,7 +247,7 @@ function getVideoIframe($ele: Cheerio<Element>) {
|
||||
if (youtubeSource) {
|
||||
const videoId = youtubeSource.src.match(/\?v=([^&]+)/)?.[1];
|
||||
if (videoId) {
|
||||
return `<iframe src="https://www.youtube-nocookie.com/embed/${videoId}" width="640" height="360" frameborder="0" allowfullscreen></iframe>`;
|
||||
return `<iframe src="https://www.youtube-nocookie.com/embed/${videoId}" width="640" height="360" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<img src="{{ image.src }}" alt="{{ image.alt }}" />
|
||||
|
||||
{{ else if page.type === 'video_block' }}
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ page.source?.split('&')[0] }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ page.source?.split('&')[0] }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
|
||||
{{ else if page.type === 'ctc_product_list' }}
|
||||
{{ each page.products product }}
|
||||
|
||||
@@ -84,7 +84,7 @@ async function parseVideo(body: VideoPost['body']) {
|
||||
ret += await getSoundCloudEmbedUrl(body.video.videoId);
|
||||
break;
|
||||
case 'youtube':
|
||||
ret += `<iframe src="https://www.youtube-nocookie.com/embed/${body.video.videoId}" frameborder="0"></iframe>`;
|
||||
ret += `<iframe src="https://www.youtube-nocookie.com/embed/${body.video.videoId}" frameborder="0" referrerpolicy="strict-origin-when-cross-origin"></iframe>`;
|
||||
break;
|
||||
case 'vimeo':
|
||||
ret += `<iframe src="https://player.vimeo.com/video/${body.video.videoId}" frameborder="0"></iframe>`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ if youTube }}
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ youTube }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ youTube }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ else if img }}
|
||||
<img src="{{ img }}">
|
||||
{{ else if video }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ if videoId }}
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ videoId }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ videoId }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ else if webm || mp4 }}
|
||||
<video controls preload="metadata" poster="{{ preview }}" width="{{ width }}">
|
||||
{{ if webm }}<source src="{{ webm }}" type="video/webm">{{ /if }}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<img src="https://ph-files.imgix.net/{{ m.imageUuid }}"><br>
|
||||
{{ else if m.mediaType === 'video' }}
|
||||
{{ if m.metadata.platform === 'youtube' }}
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ m.metadata.videoId }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ m.metadata.videoId }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ /if }}
|
||||
{{ /if }}
|
||||
{{ /each }}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
{{ set video = "https://www.youtube-nocookie.com/embed/" + video }}
|
||||
{{ /if }}
|
||||
|
||||
<iframe width="672" height="377" src="{{ video }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="672" height="377" src="{{ video }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{@ article.credits}}
|
||||
{{@ article.description}}
|
||||
|
||||
@@ -256,6 +256,7 @@ const customPreset: PresetFactory = presetHTML5.extend((tags) => ({
|
||||
title: 'YouTube video player',
|
||||
frameborder: '0',
|
||||
allowFullScreen: '1',
|
||||
refererpolicy: 'strict-origin-when-cross-origin',
|
||||
},
|
||||
}),
|
||||
video: (node, { render }) => ({
|
||||
|
||||
@@ -47,7 +47,7 @@ const render = (widgets) =>
|
||||
return `<div><ul>${w.keyFacts.map((k) => `<li>${k.text}</li>`).join('')}</ul></div>`;
|
||||
case 'inlineVideo':
|
||||
return w.provider === 'youtube'
|
||||
? `<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/${w.videoId}" frameborder="0" allowfullscreen></iframe>`
|
||||
? `<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/${w.videoId}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>`
|
||||
: new Error(`Unhandled inlineVideo provider: ${w.provider}`);
|
||||
case 'inlineImage':
|
||||
return w.inlineImageImages
|
||||
|
||||
@@ -1 +1 @@
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ video }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ video }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{{ if youTube }}
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ youTube }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ youTube }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ /if }}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ id }}" frameborder="0" allow="encrypted-media; picture-in-picture; web-share" allowfullscreen></iframe>
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ id }}" frameborder="0" allow="encrypted-media; picture-in-picture; web-share" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ if embed }}
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ videoId }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ videoId }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
{{ else }}
|
||||
<img src="{{ img.url }}">
|
||||
{{ /if }}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<iframe width="672" height="377" src="https://www.youtube-nocookie.com/embed/{{ section.youtube_id }}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="672" height="377" src="https://www.youtube-nocookie.com/embed/{{ section.youtube_id }}" frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"></iframe>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user