@ecency/render-helper 2.4.2 → 2.4.4

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.
@@ -83,8 +83,8 @@ var LBRY_REGEX = /^(https?:)?\/\/lbry.tv\/\$\/embed\/[^?#]+(?:$|[?#])/i;
83
83
  var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[^/?#]+(?:$|[?#])/i;
84
84
  var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
85
85
  var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
86
- var SPEAK_REGEX = /(?:https?:\/\/(?:3speak.([a-z]+)\/watch\?v=)|(?:3speak.([a-z]+)\/embed\?v=))([A-Za-z0-9\_\-\.\/]+)(&.*)?/i;
87
- var SPEAK_EMBED_REGEX = /^(https?:)?\/\/3speak.([a-z]+)\/embed\?[^/]+$/i;
86
+ var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak.([a-z]+)\/embed\?v=))([A-Za-z0-9\_\-\.\/]+)(&.*)?/i;
87
+ var SPEAK_EMBED_REGEX = /^(https?:)?\/\/(?:play\.)?3speak.([a-z]+)\/embed\?[^/]+$/i;
88
88
  var TWITTER_REGEX = /(?:https?:\/\/(?:(?:twitter\.com\/(.*?)\/status\/(.*))))/gi;
89
89
  var SPOTIFY_REGEX = /^https:\/\/open\.spotify\.com\/playlist\/(.*)?$/gi;
90
90
  var RUMBLE_REGEX = /^https:\/\/rumble.com\/embed\/([a-zA-Z0-9-]+)\/\?pub=\w+/;
@@ -96,7 +96,7 @@ var TWITCH_EMBED_REGEX = /^(https?:)?\/\/player.twitch.tv\/(?:\?[^/]+)?$/i;
96
96
  var BRAND_NEW_TUBE_REGEX = /^https:\/\/brandnewtube\.com\/embed\/[a-z0-9]+$/i;
97
97
  var LOOM_REGEX = /^(https?:)?\/\/www.loom.com\/share\/([^/?#]+)(?:$|[?#])/i;
98
98
  var LOOM_EMBED_REGEX = /^(https?:)?\/\/www.loom.com\/embed\/([^/?#]+)(?:$|[?#])/i;
99
- var AUREAL_EMBED_REGEX = /^(https?:\/\/)?(www\.)?(?:aureal-embed)\.web\.app\/([0-9]+)(?:$|[?#])/i;
99
+ var AUREAL_EMBED_REGEX = /^(https?:)?\/\/(www\.)?(?:aureal-embed)\.web\.app\/([0-9]+)(?:$|[?#])/i;
100
100
  var ENTITY_REGEX = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/ig;
101
101
  var SECTION_REGEX = /\B(\#[\da-zA-Z-_]+\b)(?!;)/i;
102
102
  var ID_WHITELIST = /^[A-Za-z][-A-Za-z0-9_]*$/;
@@ -339,7 +339,7 @@ function img(el, webp, state) {
339
339
  if (isInvalid) {
340
340
  src = "";
341
341
  }
342
- const isRelative = !/^https?:\/\//i.test(src) && !src.startsWith("/");
342
+ const isRelative = !/^https?:\/\//i.test(decodedSrc) && !decodedSrc.startsWith("/");
343
343
  if (isRelative) {
344
344
  src = "";
345
345
  }
@@ -859,7 +859,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
859
859
  const imgEls2 = el.getElementsByTagName("img");
860
860
  if (imgEls2.length === 1 || el.textContent.trim() === href) {
861
861
  if ((match[1] || match[2]) && match[3]) {
862
- const videoHref = `https://3speak.tv/embed?v=${match[3]}`;
862
+ const videoHref = `https://play.3speak.tv/embed?v=${match[3]}&mode=iframe`;
863
863
  el.setAttribute("class", "markdown-video-link markdown-video-link-speak");
864
864
  el.removeAttribute("href");
865
865
  el.setAttribute("data-embed-src", videoHref);
@@ -992,9 +992,12 @@ function iframe(el, parentDomain = "ecency.com") {
992
992
  return;
993
993
  }
994
994
  if (src.match(SPEAK_EMBED_REGEX)) {
995
- const normalizedSrc = src.replace(/3speak\.[a-z]+/i, "3speak.tv");
995
+ let normalizedSrc = src.replace(/3speak\.[a-z]+/i, "play.3speak.tv");
996
+ if (!/[?&]mode=iframe/.test(normalizedSrc)) {
997
+ normalizedSrc = `${normalizedSrc}${normalizedSrc.includes("?") ? "&" : "?"}mode=iframe`;
998
+ }
996
999
  const hasAutoplay = /[?&]autoplay=/.test(normalizedSrc);
997
- const s = hasAutoplay ? normalizedSrc : `${normalizedSrc}${normalizedSrc.includes("?") ? "&" : "?"}autoplay=true`;
1000
+ const s = hasAutoplay ? normalizedSrc : `${normalizedSrc}&autoplay=true`;
998
1001
  el.setAttribute("src", s);
999
1002
  return;
1000
1003
  }
@@ -1081,7 +1084,8 @@ function iframe(el, parentDomain = "ecency.com") {
1081
1084
  return;
1082
1085
  }
1083
1086
  if (src.match(AUREAL_EMBED_REGEX)) {
1084
- el.setAttribute("src", src);
1087
+ const normalizedSrc = src.startsWith("//") ? `https:${src}` : src;
1088
+ el.setAttribute("src", normalizedSrc);
1085
1089
  el.setAttribute("frameborder", "0");
1086
1090
  return;
1087
1091
  }