Skip to content

Commit e031414

Browse files
authored
Merge pull request #1699 from lfzawacki/main
Update youtube embeds to prevent 'error 153'
2 parents ab1ac31 + e2ad2db commit e031414

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

electron/json/cors.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"http://localhost:*",
3737
"data:",
3838
"file://*",
39-
"https://*.youtube.com",
39+
"https://*.youtube.com",
40+
"https://*.youtube-nocookie.com",
4041
"https://*.spotify.com",
4142
"https://*.spotifycdn.com",
4243
"https://*.vimeocdn.com",
@@ -67,6 +68,7 @@
6768
"file://*",
6869
"http://localhost:*",
6970
"https://*.youtube.com",
71+
"https://*.youtube-nocookie.com",
7072
"https://*.spotify.com",
7173
"https://*.spotifycdn.com",
7274
"https://encore.scdn.co/",
@@ -95,6 +97,7 @@
9597
"https://api.amplitude.com",
9698
"devtools://devtools",
9799
"https://*.youtube.com",
100+
"https://*.youtube-nocookie.com",
98101
"https://*.spotify.com",
99102
"https://*.spotifycdn.com",
100103
"https://*.vimeocdn.com",
@@ -151,6 +154,7 @@
151154
"https://sentry.io",
152155
"devtools://devtools",
153156
"https://*.youtube.com",
157+
"https://*.youtube-nocookie.com",
154158
"https://*.spotify.com",
155159
"https://*.spotifycdn.com",
156160
"https://*.vimeocdn.com",
@@ -191,6 +195,7 @@
191195
"file://*",
192196
"http://localhost:*/embed/iframe.html",
193197
"https://*.youtube.com",
198+
"https://*.youtube-nocookie.com",
194199
"https://*.spotify.com",
195200
"https://*.spotifycdn.com",
196201
"https://*.vimeo.com",

src/ts/lib/util/embed.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { I, U, J } from 'Lib';
22

33
const DOMAINS: any = {};
4-
DOMAINS[I.EmbedProcessor.Youtube] = [ 'youtube.com', 'youtu.be' ];
4+
DOMAINS[I.EmbedProcessor.Youtube] = [ 'youtube.com', 'youtu.be', 'youtube-nocookie.com' ];
55
DOMAINS[I.EmbedProcessor.Vimeo] = [ 'vimeo.com' ];
66
DOMAINS[I.EmbedProcessor.GoogleMaps] = [ 'google.[^\/]+/maps' ];
77
DOMAINS[I.EmbedProcessor.Miro] = [ 'miro.com' ];
@@ -44,7 +44,7 @@ class UtilEmbed {
4444
a.search += '&enablejsapi=1&rel=0';
4545
url = a.toString();
4646
} catch (e) {};
47-
return `<iframe id="player" src="${url.toString()}" ${IFRAME_PARAM} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe>`;
47+
return `<iframe id="player" src="${url.toString()}" ${IFRAME_PARAM} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin"></iframe>`;
4848
};
4949

5050
/**
@@ -206,7 +206,7 @@ class UtilEmbed {
206206

207207
switch (processor) {
208208
case I.EmbedProcessor.Youtube: {
209-
url = `https://www.youtube.com/embed/${this.getYoutubePath(url)}`;
209+
url = `https://www.youtube-nocookie.com/embed/${this.getYoutubePath(url)}`;
210210
break;
211211
};
212212

0 commit comments

Comments
 (0)