nodebb-plugin-link-preview 1.2.0 → 1.2.2

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,18 @@ 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;
191
+ } else if (pathname.startsWith('/live')) {
192
+ video = pathname.split('/')[2];
187
193
  } else {
188
194
  video = searchParams.get('v');
189
195
  }
190
- const html = await app.renderAsync('partials/link-preview/youtube', { video });
196
+ const html = await app.renderAsync(short ? 'partials/link-preview/youtube-short' : 'partials/link-preview/youtube', { video });
191
197
  $anchor.replaceWith(html);
192
198
 
193
199
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-link-preview",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A starter kit for quickly creating NodeBB plugins",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
 
58
58
  <div class="form-check form-switch mb-3">
59
59
  <input type="checkbox" class="form-check-input" id="embedTiktok" name="embedTiktok">
60
- <label for="embedTiktok" class="form-check-label">Vimeo</label>
60
+ <label for="embedTiktok" class="form-check-label">Tiktok</label>
61
61
  </div>
62
62
  </div>
63
63
  </form>
@@ -1,3 +1,5 @@
1
- <div class="ratio" style="--bs-aspect-ratio: 200%;">
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>
1
+ <div class="col-sm-6">
2
+ <div class="ratio" style="--bs-aspect-ratio: 177%;">
3
+ <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>
4
+ </div>
3
5
  </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>