@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.
@@ -92,8 +92,8 @@ var LBRY_REGEX = /^(https?:)?\/\/lbry.tv\/\$\/embed\/[^?#]+(?:$|[?#])/i;
92
92
  var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[^/?#]+(?:$|[?#])/i;
93
93
  var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
94
94
  var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
95
- var SPEAK_REGEX = /(?:https?:\/\/(?:3speak.([a-z]+)\/watch\?v=)|(?:3speak.([a-z]+)\/embed\?v=))([A-Za-z0-9\_\-\.\/]+)(&.*)?/i;
96
- var SPEAK_EMBED_REGEX = /^(https?:)?\/\/3speak.([a-z]+)\/embed\?[^/]+$/i;
95
+ var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak.([a-z]+)\/embed\?v=))([A-Za-z0-9\_\-\.\/]+)(&.*)?/i;
96
+ var SPEAK_EMBED_REGEX = /^(https?:)?\/\/(?:play\.)?3speak.([a-z]+)\/embed\?[^/]+$/i;
97
97
  var TWITTER_REGEX = /(?:https?:\/\/(?:(?:twitter\.com\/(.*?)\/status\/(.*))))/gi;
98
98
  var SPOTIFY_REGEX = /^https:\/\/open\.spotify\.com\/playlist\/(.*)?$/gi;
99
99
  var RUMBLE_REGEX = /^https:\/\/rumble.com\/embed\/([a-zA-Z0-9-]+)\/\?pub=\w+/;
@@ -105,7 +105,7 @@ var TWITCH_EMBED_REGEX = /^(https?:)?\/\/player.twitch.tv\/(?:\?[^/]+)?$/i;
105
105
  var BRAND_NEW_TUBE_REGEX = /^https:\/\/brandnewtube\.com\/embed\/[a-z0-9]+$/i;
106
106
  var LOOM_REGEX = /^(https?:)?\/\/www.loom.com\/share\/([^/?#]+)(?:$|[?#])/i;
107
107
  var LOOM_EMBED_REGEX = /^(https?:)?\/\/www.loom.com\/embed\/([^/?#]+)(?:$|[?#])/i;
108
- var AUREAL_EMBED_REGEX = /^(https?:\/\/)?(www\.)?(?:aureal-embed)\.web\.app\/([0-9]+)(?:$|[?#])/i;
108
+ var AUREAL_EMBED_REGEX = /^(https?:)?\/\/(www\.)?(?:aureal-embed)\.web\.app\/([0-9]+)(?:$|[?#])/i;
109
109
  var ENTITY_REGEX = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/ig;
110
110
  var SECTION_REGEX = /\B(\#[\da-zA-Z-_]+\b)(?!;)/i;
111
111
  var ID_WHITELIST = /^[A-Za-z][-A-Za-z0-9_]*$/;
@@ -348,7 +348,7 @@ function img(el, webp, state) {
348
348
  if (isInvalid) {
349
349
  src = "";
350
350
  }
351
- const isRelative = !/^https?:\/\//i.test(src) && !src.startsWith("/");
351
+ const isRelative = !/^https?:\/\//i.test(decodedSrc) && !decodedSrc.startsWith("/");
352
352
  if (isRelative) {
353
353
  src = "";
354
354
  }
@@ -868,7 +868,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
868
868
  const imgEls2 = el.getElementsByTagName("img");
869
869
  if (imgEls2.length === 1 || el.textContent.trim() === href) {
870
870
  if ((match[1] || match[2]) && match[3]) {
871
- const videoHref = `https://3speak.tv/embed?v=${match[3]}`;
871
+ const videoHref = `https://play.3speak.tv/embed?v=${match[3]}&mode=iframe`;
872
872
  el.setAttribute("class", "markdown-video-link markdown-video-link-speak");
873
873
  el.removeAttribute("href");
874
874
  el.setAttribute("data-embed-src", videoHref);
@@ -1001,9 +1001,12 @@ function iframe(el, parentDomain = "ecency.com") {
1001
1001
  return;
1002
1002
  }
1003
1003
  if (src.match(SPEAK_EMBED_REGEX)) {
1004
- const normalizedSrc = src.replace(/3speak\.[a-z]+/i, "3speak.tv");
1004
+ let normalizedSrc = src.replace(/3speak\.[a-z]+/i, "play.3speak.tv");
1005
+ if (!/[?&]mode=iframe/.test(normalizedSrc)) {
1006
+ normalizedSrc = `${normalizedSrc}${normalizedSrc.includes("?") ? "&" : "?"}mode=iframe`;
1007
+ }
1005
1008
  const hasAutoplay = /[?&]autoplay=/.test(normalizedSrc);
1006
- const s = hasAutoplay ? normalizedSrc : `${normalizedSrc}${normalizedSrc.includes("?") ? "&" : "?"}autoplay=true`;
1009
+ const s = hasAutoplay ? normalizedSrc : `${normalizedSrc}&autoplay=true`;
1007
1010
  el.setAttribute("src", s);
1008
1011
  return;
1009
1012
  }
@@ -1090,7 +1093,8 @@ function iframe(el, parentDomain = "ecency.com") {
1090
1093
  return;
1091
1094
  }
1092
1095
  if (src.match(AUREAL_EMBED_REGEX)) {
1093
- el.setAttribute("src", src);
1096
+ const normalizedSrc = src.startsWith("//") ? `https:${src}` : src;
1097
+ el.setAttribute("src", normalizedSrc);
1094
1098
  el.setAttribute("frameborder", "0");
1095
1099
  return;
1096
1100
  }