@ecency/render-helper 2.5.33 → 2.5.35
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/dist/browser/index.d.ts +12 -1
- package/dist/browser/index.js +22 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +22 -2
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +22 -3
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -747,7 +747,6 @@ var isSafeNavValue = (value) => {
|
|
|
747
747
|
const isRelative = /^(\/\/|\/[^/]?|#|\?|[a-z0-9._\-]+(\/|$))/i.test(trimmed);
|
|
748
748
|
return isSafeScheme || isRelative;
|
|
749
749
|
};
|
|
750
|
-
var decodeEntities2 = (input) => input.replace(/&#(\d+);?/g, (_, dec) => String.fromCodePoint(Number(dec))).replace(/&#x([0-9a-f]+);?/gi, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
|
|
751
750
|
var isProxyPSrcset = (srcset) => {
|
|
752
751
|
const base = trimTrailingSlash(getProxyBase());
|
|
753
752
|
const candidates = srcset.split(",").map((c) => c.trim().split(/\s+/)[0]).filter(Boolean);
|
|
@@ -761,7 +760,7 @@ function sanitizeHtml(html) {
|
|
|
761
760
|
css: false,
|
|
762
761
|
// block style attrs entirely for safety
|
|
763
762
|
onTagAttr: (tag, name, value) => {
|
|
764
|
-
const decoded =
|
|
763
|
+
const decoded = decodeEntities(value.trim());
|
|
765
764
|
const decodedLower = decoded.toLowerCase();
|
|
766
765
|
if (name.startsWith("on")) return "";
|
|
767
766
|
if (tag === "img" && name === "src" && !/^https?:\/\//.test(decodedLower)) return "";
|
|
@@ -10831,6 +10830,26 @@ function getImage(entry, width = 0, height = 0, format = "match", fastMode = fal
|
|
|
10831
10830
|
}
|
|
10832
10831
|
return null;
|
|
10833
10832
|
}
|
|
10833
|
+
function getEntryCardImageRawUrl(obj) {
|
|
10834
|
+
if (typeof obj === "string") {
|
|
10835
|
+
return getEntryImageRawUrl(obj);
|
|
10836
|
+
}
|
|
10837
|
+
let meta;
|
|
10838
|
+
if (typeof obj.json_metadata === "object") {
|
|
10839
|
+
meta = obj.json_metadata;
|
|
10840
|
+
} else {
|
|
10841
|
+
try {
|
|
10842
|
+
meta = JSON.parse(obj.json_metadata);
|
|
10843
|
+
} catch (e) {
|
|
10844
|
+
meta = null;
|
|
10845
|
+
}
|
|
10846
|
+
}
|
|
10847
|
+
const thumbnail = firstMetaUrl(meta?.thumbnails);
|
|
10848
|
+
if (thumbnail) {
|
|
10849
|
+
return decodeImageSrc(thumbnail);
|
|
10850
|
+
}
|
|
10851
|
+
return getEntryImageRawUrl(obj);
|
|
10852
|
+
}
|
|
10834
10853
|
function getEntryImageRawUrl(obj) {
|
|
10835
10854
|
if (typeof obj === "string") {
|
|
10836
10855
|
const src = findFirstImageUrl(obj, true);
|
|
@@ -10982,6 +11001,6 @@ function getPostBodySummary(obj, length, platform) {
|
|
|
10982
11001
|
return res;
|
|
10983
11002
|
}
|
|
10984
11003
|
|
|
10985
|
-
export { IMAGE_SIZES, SECTION_LIST, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
|
11004
|
+
export { IMAGE_SIZES, SECTION_LIST, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryCardImageRawUrl, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
|
10986
11005
|
//# sourceMappingURL=index.mjs.map
|
|
10987
11006
|
//# sourceMappingURL=index.mjs.map
|