@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.cjs
CHANGED
|
@@ -774,7 +774,6 @@ var isSafeNavValue = (value) => {
|
|
|
774
774
|
const isRelative = /^(\/\/|\/[^/]?|#|\?|[a-z0-9._\-]+(\/|$))/i.test(trimmed);
|
|
775
775
|
return isSafeScheme || isRelative;
|
|
776
776
|
};
|
|
777
|
-
var decodeEntities2 = (input) => input.replace(/&#(\d+);?/g, (_, dec) => String.fromCodePoint(Number(dec))).replace(/&#x([0-9a-f]+);?/gi, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
|
|
778
777
|
var isProxyPSrcset = (srcset) => {
|
|
779
778
|
const base = trimTrailingSlash(getProxyBase());
|
|
780
779
|
const candidates = srcset.split(",").map((c) => c.trim().split(/\s+/)[0]).filter(Boolean);
|
|
@@ -788,7 +787,7 @@ function sanitizeHtml(html) {
|
|
|
788
787
|
css: false,
|
|
789
788
|
// block style attrs entirely for safety
|
|
790
789
|
onTagAttr: (tag, name, value) => {
|
|
791
|
-
const decoded =
|
|
790
|
+
const decoded = decodeEntities(value.trim());
|
|
792
791
|
const decodedLower = decoded.toLowerCase();
|
|
793
792
|
if (name.startsWith("on")) return "";
|
|
794
793
|
if (tag === "img" && name === "src" && !/^https?:\/\//.test(decodedLower)) return "";
|
|
@@ -10858,6 +10857,26 @@ function getImage(entry, width = 0, height = 0, format = "match", fastMode = fal
|
|
|
10858
10857
|
}
|
|
10859
10858
|
return null;
|
|
10860
10859
|
}
|
|
10860
|
+
function getEntryCardImageRawUrl(obj) {
|
|
10861
|
+
if (typeof obj === "string") {
|
|
10862
|
+
return getEntryImageRawUrl(obj);
|
|
10863
|
+
}
|
|
10864
|
+
let meta;
|
|
10865
|
+
if (typeof obj.json_metadata === "object") {
|
|
10866
|
+
meta = obj.json_metadata;
|
|
10867
|
+
} else {
|
|
10868
|
+
try {
|
|
10869
|
+
meta = JSON.parse(obj.json_metadata);
|
|
10870
|
+
} catch (e) {
|
|
10871
|
+
meta = null;
|
|
10872
|
+
}
|
|
10873
|
+
}
|
|
10874
|
+
const thumbnail = firstMetaUrl(meta?.thumbnails);
|
|
10875
|
+
if (thumbnail) {
|
|
10876
|
+
return decodeImageSrc(thumbnail);
|
|
10877
|
+
}
|
|
10878
|
+
return getEntryImageRawUrl(obj);
|
|
10879
|
+
}
|
|
10861
10880
|
function getEntryImageRawUrl(obj) {
|
|
10862
10881
|
if (typeof obj === "string") {
|
|
10863
10882
|
const src = findFirstImageUrl(obj, true);
|
|
@@ -11015,6 +11034,7 @@ exports.buildPictureSources = buildPictureSources;
|
|
|
11015
11034
|
exports.buildSrcSet = buildSrcSet;
|
|
11016
11035
|
exports.buildSrcSetForFormat = buildSrcSetForFormat;
|
|
11017
11036
|
exports.catchPostImage = catchPostImage;
|
|
11037
|
+
exports.getEntryCardImageRawUrl = getEntryCardImageRawUrl;
|
|
11018
11038
|
exports.getEntryImageRawUrl = getEntryImageRawUrl;
|
|
11019
11039
|
exports.isAllowedEmbedSrc = isAllowedEmbedSrc;
|
|
11020
11040
|
exports.isLegacySizedProxyUrl = isLegacySizedProxyUrl;
|