nodebb-plugin-link-preview 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/library.js
CHANGED
|
@@ -182,12 +182,16 @@ async function handleSpecialEmbed(url, $anchor) {
|
|
|
182
182
|
|
|
183
183
|
if (embedYoutube === 'on' && ['youtube.com', 'www.youtube.com', 'youtu.be'].some(x => hostname === x)) {
|
|
184
184
|
let video;
|
|
185
|
+
let short = false;
|
|
185
186
|
if (hostname === 'youtu.be') {
|
|
186
187
|
video = pathname.slice(1);
|
|
188
|
+
} else if (pathname.startsWith('/shorts')) {
|
|
189
|
+
video = pathname.split('/')[2];
|
|
190
|
+
short = true;
|
|
187
191
|
} else {
|
|
188
192
|
video = searchParams.get('v');
|
|
189
193
|
}
|
|
190
|
-
const html = await app.renderAsync('partials/link-preview/youtube', { video });
|
|
194
|
+
const html = await app.renderAsync(short ? 'partials/link-preview/youtube-short' : 'partials/link-preview/youtube', { video });
|
|
191
195
|
$anchor.replaceWith(html);
|
|
192
196
|
|
|
193
197
|
return true;
|
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<div class="ratio" style="--bs-aspect-ratio:
|
|
1
|
+
<div class="ratio" style="--bs-aspect-ratio: 177%;">
|
|
2
2
|
<iframe src="https://www.tiktok.com/embed/v2/{video}" title="TikTok video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
|
|
3
3
|
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<div class="col-sm-6">
|
|
2
|
+
<div class="ratio" style="--bs-aspect-ratio: 177%;">
|
|
3
|
+
<iframe src="https://www.youtube-nocookie.com/embed/{video}" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
|
|
4
|
+
</div>
|
|
5
|
+
</div>
|