Make youtube embeds lighter

And possibly more privacy-enhanced
This commit is contained in:
Lim Chee Aun 2023-03-18 20:05:12 +08:00
parent 94b96bd534
commit ed3d86c67a
3 changed files with 20 additions and 0 deletions

11
package-lock.json generated
View file

@ -11,6 +11,7 @@
"@formatjs/intl-localematcher": "~0.2.32", "@formatjs/intl-localematcher": "~0.2.32",
"@github/text-expander-element": "~2.3.0", "@github/text-expander-element": "~2.3.0",
"@iconify-icons/mingcute": "~1.2.4", "@iconify-icons/mingcute": "~1.2.4",
"@justinribeiro/lite-youtube": "~1.5.0",
"@szhsin/react-menu": "~3.5.2", "@szhsin/react-menu": "~3.5.2",
"dayjs": "~1.11.7", "dayjs": "~1.11.7",
"dayjs-twitter": "~0.5.0", "dayjs-twitter": "~0.5.0",
@ -2620,6 +2621,11 @@
"resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz", "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz",
"integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==" "integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA=="
}, },
"node_modules/@justinribeiro/lite-youtube": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@justinribeiro/lite-youtube/-/lite-youtube-1.5.0.tgz",
"integrity": "sha512-TU92RKtz9BI9PRYrVwDIUsnFadLZtqRKWl1ZOdbxb7roJDb8Dd/xURllAsLEmCg6oJNyhXlVa5RsnUc0EKd8Cw=="
},
"node_modules/@lukeed/csprng": { "node_modules/@lukeed/csprng": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz",
@ -8816,6 +8822,11 @@
"resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz", "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz",
"integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==" "integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA=="
}, },
"@justinribeiro/lite-youtube": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@justinribeiro/lite-youtube/-/lite-youtube-1.5.0.tgz",
"integrity": "sha512-TU92RKtz9BI9PRYrVwDIUsnFadLZtqRKWl1ZOdbxb7roJDb8Dd/xURllAsLEmCg6oJNyhXlVa5RsnUc0EKd8Cw=="
},
"@lukeed/csprng": { "@lukeed/csprng": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz",

View file

@ -13,6 +13,7 @@
"@formatjs/intl-localematcher": "~0.2.32", "@formatjs/intl-localematcher": "~0.2.32",
"@github/text-expander-element": "~2.3.0", "@github/text-expander-element": "~2.3.0",
"@iconify-icons/mingcute": "~1.2.4", "@iconify-icons/mingcute": "~1.2.4",
"@justinribeiro/lite-youtube": "~1.5.0",
"@szhsin/react-menu": "~3.5.2", "@szhsin/react-menu": "~3.5.2",
"dayjs": "~1.11.7", "dayjs": "~1.11.7",
"dayjs-twitter": "~0.5.0", "dayjs-twitter": "~0.5.0",

View file

@ -1,5 +1,6 @@
import './status.css'; import './status.css';
import '@justinribeiro/lite-youtube';
import { import {
ControlledMenu, ControlledMenu,
Menu, Menu,
@ -1195,6 +1196,13 @@ function Card({ card, instance }) {
</a> </a>
); );
} else if (type === 'video') { } else if (type === 'video') {
if (/youtube/i.test(providerName)) {
// Get ID from e.g. https://www.youtube.com/watch?v=[VIDEO_ID]
const videoID = url.match(/watch\?v=([^&]+)/)?.[1];
if (videoID) {
return <lite-youtube videoid={videoID} nocookie></lite-youtube>;
}
}
return ( return (
<div <div
class="card video" class="card video"