@ecency/render-helper 2.5.34 → 2.5.36

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.
@@ -10282,10 +10282,6 @@ function markdown2Html(obj, forApp = true, _webp = false, parentDomain = "ecency
10282
10282
  }
10283
10283
 
10284
10284
  // src/catch-post-image.ts
10285
- var gifLinkRegex = /\.(gif)$/i;
10286
- function isGifLink(link) {
10287
- return gifLinkRegex.test(link);
10288
- }
10289
10285
  var BACKTICK_FENCE_RE = /```[\s\S]*?```/g;
10290
10286
  var TILDE_FENCE_RE = /~~~[\s\S]*?~~~/g;
10291
10287
  var INLINE_CODE_RE = /`[^`\n]*`/g;
@@ -10790,11 +10786,7 @@ function firstMetaUrl(value) {
10790
10786
  return void 0;
10791
10787
  }
10792
10788
  function proxifyFound(src, width, height, format) {
10793
- const decoded = decodeEntities(src);
10794
- if (isGifLink(decoded)) {
10795
- return proxifyImageSrc(decoded, 0, 0, format);
10796
- }
10797
- return proxifyImageSrc(decoded, width, height, format);
10789
+ return proxifyImageSrc(decodeEntities(src), width, height, format);
10798
10790
  }
10799
10791
  function getImage(entry, width = 0, height = 0, format = "match", fastMode = false) {
10800
10792
  let meta;
@@ -10809,29 +10801,17 @@ function getImage(entry, width = 0, height = 0, format = "match", fastMode = fal
10809
10801
  }
10810
10802
  const thumbnail = firstMetaUrl(meta?.thumbnails);
10811
10803
  if (thumbnail) {
10812
- const decodedThumbnail = decodeEntities(thumbnail);
10813
- const proxied = isGifLink(decodedThumbnail) ? proxifyImageSrc(decodedThumbnail, 0, 0, format) : proxifyImageSrc(decodedThumbnail, width, height, format);
10804
+ const proxied = proxifyImageSrc(decodeEntities(thumbnail), width, height, format);
10814
10805
  if (proxied) {
10815
10806
  return proxied;
10816
10807
  }
10817
10808
  }
10818
10809
  if (meta && typeof meta.image === "string" && meta.image.length > 0) {
10819
- const decodedImage = decodeEntities(meta.image);
10820
- if (isGifLink(decodedImage)) {
10821
- return proxifyImageSrc(decodedImage, 0, 0, format);
10822
- }
10823
- return proxifyImageSrc(decodedImage, width, height, format);
10810
+ return proxifyImageSrc(decodeEntities(meta.image), width, height, format);
10824
10811
  }
10825
10812
  if (meta && meta.image && !!meta.image.length && meta.image[0]) {
10826
10813
  if (typeof meta.image[0] === "string") {
10827
- const decodedImage = decodeEntities(meta.image[0]);
10828
- if (isGifLink(decodedImage)) {
10829
- return proxifyImageSrc(decodedImage, 0, 0, format);
10830
- }
10831
- return proxifyImageSrc(decodedImage, width, height, format);
10832
- }
10833
- if (isGifLink(meta.image[0])) {
10834
- return proxifyImageSrc(meta.image[0], 0, 0, format);
10814
+ return proxifyImageSrc(decodeEntities(meta.image[0]), width, height, format);
10835
10815
  }
10836
10816
  return proxifyImageSrc(meta.image[0], width, height, format);
10837
10817
  }
@@ -10857,6 +10837,26 @@ function getImage(entry, width = 0, height = 0, format = "match", fastMode = fal
10857
10837
  }
10858
10838
  return null;
10859
10839
  }
10840
+ function getEntryCardImageRawUrl(obj) {
10841
+ if (typeof obj === "string") {
10842
+ return getEntryImageRawUrl(obj);
10843
+ }
10844
+ let meta;
10845
+ if (typeof obj.json_metadata === "object") {
10846
+ meta = obj.json_metadata;
10847
+ } else {
10848
+ try {
10849
+ meta = JSON.parse(obj.json_metadata);
10850
+ } catch (e) {
10851
+ meta = null;
10852
+ }
10853
+ }
10854
+ const thumbnail = firstMetaUrl(meta?.thumbnails);
10855
+ if (thumbnail) {
10856
+ return decodeImageSrc(thumbnail);
10857
+ }
10858
+ return getEntryImageRawUrl(obj);
10859
+ }
10860
10860
  function getEntryImageRawUrl(obj) {
10861
10861
  if (typeof obj === "string") {
10862
10862
  const src = findFirstImageUrl(obj, true);
@@ -11014,6 +11014,7 @@ exports.buildPictureSources = buildPictureSources;
11014
11014
  exports.buildSrcSet = buildSrcSet;
11015
11015
  exports.buildSrcSetForFormat = buildSrcSetForFormat;
11016
11016
  exports.catchPostImage = catchPostImage;
11017
+ exports.getEntryCardImageRawUrl = getEntryCardImageRawUrl;
11017
11018
  exports.getEntryImageRawUrl = getEntryImageRawUrl;
11018
11019
  exports.isAllowedEmbedSrc = isAllowedEmbedSrc;
11019
11020
  exports.isLegacySizedProxyUrl = isLegacySizedProxyUrl;