diff --git a/public/index.html b/public/index.html
index a8cdd9b6..e34664d5 100644
--- a/public/index.html
+++ b/public/index.html
@@ -8,7 +8,7 @@
+ content="default-src 'self'; child-src 'none'; frame-src youtube.com www.youtube.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src wss://* 'self' https://*; img-src * data:; font-src https://fonts.gstatic.com; media-src *; script-src 'self' https://static.cloudflareinsights.com;" />
diff --git a/src/Text.js b/src/Text.js
index d8c90558..8107d3d6 100644
--- a/src/Text.js
+++ b/src/Text.js
@@ -10,8 +10,10 @@ export function extractLinks(fragments) {
return f.split(UrlRegex).map(a => {
if (a.startsWith("http")) {
try {
- let url = new URL(a);
- let ext = url.pathname.toLowerCase().match(FileExtensionRegex);
+ const url = new URL(a);
+ const vParam = url.searchParams.get('v')
+ const isYoutube = (url.host === "www.youtube.com" || url.host === "youtube.com" ) && vParam
+ const ext = url.pathname.toLowerCase().match(FileExtensionRegex);
if (ext) {
switch (ext[1]) {
case "gif":
@@ -30,6 +32,16 @@ export function extractLinks(fragments) {
return
}
}
+ } else if (isYoutube) {
+ return (
+
+ )
} else {
return {url.toString()}
}