Merge pull request #27 from v0l/youtube-m

fix: support m.youtube.com subdomain links
This commit is contained in:
Kieran 2023-01-10 16:39:48 +00:00 committed by GitHub
commit eabc3c8307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -61,4 +61,4 @@ export const InvoiceRegex = /(lnbc\w+)/i;
/**
* YouTube URL regex
*/
export const YoutubeUrlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/
export const YoutubeUrlRegex = /^(?:https?:\/\/)?(?:www|m\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/

View File

@ -35,6 +35,7 @@ function transformHttpLink(a) {
<>
<br />
<iframe
className="w-max"
src={`https://www.youtube.com/embed/${youtubeId}`}
title="YouTube video player"
frameBorder="0"

View File

@ -32,12 +32,15 @@
.note > .body img, .note > .body video, .note > .body iframe {
max-width: 100%;
max-height: 500px;
margin: 10px;
margin-left: auto;
margin-right: auto;
margin: 10px auto;
display: block;
}
.note > .body iframe, note > .body video {
width: -webkit-fill-available;
aspect-ratio: 16 / 9;
}
.note > .header img:hover, .note > .header .name > .reply:hover, .note .body:hover {
cursor: pointer;
}