@ecency/render-helper 2.5.13 → 2.5.15
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.js +24 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +24 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +24 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -83,6 +83,7 @@ var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak\.([a-z]+)\/watch\?v=)|(?:(
|
|
|
83
83
|
var SPEAK_EMBED_REGEX = /^(https?:)?\/\/(?:play\.)?3speak\.([a-z]+)\/(?:embed|watch)\?.+$/i;
|
|
84
84
|
var SPEAK_AUDIO_REGEX = /https?:\/\/audio\.3speak\.tv\/play\?[^\s]+/i;
|
|
85
85
|
var SPEAK_AUDIO_EMBED_REGEX = /^https?:\/\/audio\.3speak\.tv\/play\?.+$/i;
|
|
86
|
+
var LIKETU_AUDIO_REGEX = /^https?:\/\/cdn\.liketu\.com\/.+\.(?:webm|mp3|m4a|ogg|wav)(?:\?.*)?$/i;
|
|
86
87
|
var TWITTER_REGEX = /(?:https?:\/\/(?:(?:twitter\.com\/(.*?)\/status\/(.*))))/gi;
|
|
87
88
|
var SPOTIFY_REGEX = /^https:\/\/open\.spotify\.com\/playlist\/(.*)?$/gi;
|
|
88
89
|
var RUMBLE_REGEX = /^https:\/\/rumble\.com\/embed\/([a-zA-Z0-9-]+)\/\?pub=\w+/;
|
|
@@ -143,6 +144,7 @@ var ALLOWED_ATTRIBUTES = {
|
|
|
143
144
|
"span": ["class", "id", "data-align"],
|
|
144
145
|
"iframe": ["src", "class", "frameborder", "allowfullscreen", "webkitallowfullscreen", "mozallowfullscreen", "sandbox"],
|
|
145
146
|
"video": ["src", "controls", "poster"],
|
|
147
|
+
"audio": ["src", "controls", "preload"],
|
|
146
148
|
"div": ["class", "id", "data-align"],
|
|
147
149
|
"strong": [],
|
|
148
150
|
"b": [],
|
|
@@ -693,7 +695,8 @@ function sanitizeHtml(html) {
|
|
|
693
695
|
}
|
|
694
696
|
if (tag === "source" && name === "srcset" && !isProxyPSrcset(decoded)) return "";
|
|
695
697
|
if (tag === "source" && name === "type" && decodedLower !== "image/avif" && decodedLower !== "image/webp") return "";
|
|
696
|
-
if (tag === "video" && ["src", "poster"].includes(name) && !/^https?:\/\//.test(decodedLower)) return "";
|
|
698
|
+
if ((tag === "video" || tag === "audio") && ["src", "poster"].includes(name) && !/^https?:\/\//.test(decodedLower)) return "";
|
|
699
|
+
if (tag === "audio" && name === "preload" && decodedLower !== "metadata" && decodedLower !== "none") return "";
|
|
697
700
|
if (tag === "img" && ["dynsrc", "lowsrc"].includes(name)) return "";
|
|
698
701
|
if (tag === "span" && name === "class" && decoded.toLowerCase().trim() === "wr") return "";
|
|
699
702
|
if (EMBED_SRC_DATA_ATTRS.has(name) && !isAllowedEmbedSrc(decoded)) return "";
|
|
@@ -1405,6 +1408,17 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1405
1408
|
el.appendChild(ifr);
|
|
1406
1409
|
return;
|
|
1407
1410
|
}
|
|
1411
|
+
if (href.match(LIKETU_AUDIO_REGEX)) {
|
|
1412
|
+
el.setAttribute("class", "markdown-audio-link markdown-audio-link-liketu");
|
|
1413
|
+
el.removeAttribute("href");
|
|
1414
|
+
el.textContent = "";
|
|
1415
|
+
const audio = el.ownerDocument.createElement("audio");
|
|
1416
|
+
audio.setAttribute("controls", "");
|
|
1417
|
+
audio.setAttribute("preload", "metadata");
|
|
1418
|
+
audio.setAttribute("src", href);
|
|
1419
|
+
el.appendChild(audio);
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1408
1422
|
const matchT = href.match(TWITTER_REGEX);
|
|
1409
1423
|
if (matchT && el.textContent.trim() === href) {
|
|
1410
1424
|
TWITTER_REGEX.lastIndex = 0;
|
|
@@ -1601,8 +1615,11 @@ function iframe(el, parentDomain = "ecency.com", forApp = false, renderOptions)
|
|
|
1601
1615
|
return;
|
|
1602
1616
|
}
|
|
1603
1617
|
if (src.match(SKATEHIVE_IPFS_REGEX)) {
|
|
1604
|
-
el.
|
|
1605
|
-
|
|
1618
|
+
const video = el.ownerDocument.createElement("video");
|
|
1619
|
+
video.setAttribute("src", src);
|
|
1620
|
+
video.setAttribute("controls", "");
|
|
1621
|
+
el.parentNode.insertBefore(video, el);
|
|
1622
|
+
el.parentNode.removeChild(el);
|
|
1606
1623
|
return;
|
|
1607
1624
|
}
|
|
1608
1625
|
if (src.match(SKATEHYPE_EMBED_REGEX)) {
|
|
@@ -1864,7 +1881,10 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1864
1881
|
|
|
1865
1882
|
// src/methods/clean-reply.method.ts
|
|
1866
1883
|
function cleanReply(s) {
|
|
1867
|
-
return (s ? s.split("\n").filter((item) => item.toLowerCase().includes("posted using [partiko") === false).filter((item) => item.toLowerCase().includes("posted using [dapplr") === false).filter((item) => item.toLowerCase().includes("posted using [leofinance") === false).filter((item) => item.toLowerCase().includes("posted via [neoxian") === false).filter((item) => item.toLowerCase().includes("posted using [neoxian") === false).filter((item) => item.toLowerCase().includes("posted via [first context") === false).filter((item) => item.toLowerCase().includes("posted with [stemgeeks") === false).filter((item) => item.toLowerCase().includes("posted using [bilpcoin") === false).filter((item) => item.toLowerCase().includes("posted using [inleo") === false).filter((item) => item.toLowerCase().includes("posted using [sportstalksocial]") === false).filter((item) => item.toLowerCase().includes("<center><sub>[posted using aeneas.blog") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [proofofbrain.io") === false).filter((item) => item.toLowerCase().includes("<center>posted on [hypnochain") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [weedcash.network") === false).filter((item) => item.toLowerCase().includes("<center>posted on [naturalmedicine.io") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [musicforlife.io") === false).filter((item) => item.toLowerCase().includes("if the truvvl embed is unsupported by your current frontend, click this link to view this story") === false).filter((item) => item.toLowerCase().includes("<center><em>posted from truvvl") === false).filter((item) => item.toLowerCase().includes('view this post <a href="https://travelfeed.io/') === false).filter((item) => item.toLowerCase().includes("read this post on travelfeed.io for the best experience") === false).filter((item) => item.toLowerCase().includes('posted via <a href="https://www.dporn.co/"') === false).filter((item) => item.toLowerCase().includes("\u25B6\uFE0F [watch on 3speak](https://3speak") === false).filter((item) => item.toLowerCase().includes("<sup><sub>posted via [inji.com]") === false).filter((item) => item.toLowerCase().includes("view this post on [liketu]") === false).filter((item) =>
|
|
1884
|
+
return (s ? s.split("\n").filter((item) => item.toLowerCase().includes("posted using [partiko") === false).filter((item) => item.toLowerCase().includes("posted using [dapplr") === false).filter((item) => item.toLowerCase().includes("posted using [leofinance") === false).filter((item) => item.toLowerCase().includes("posted via [neoxian") === false).filter((item) => item.toLowerCase().includes("posted using [neoxian") === false).filter((item) => item.toLowerCase().includes("posted via [first context") === false).filter((item) => item.toLowerCase().includes("posted with [stemgeeks") === false).filter((item) => item.toLowerCase().includes("posted using [bilpcoin") === false).filter((item) => item.toLowerCase().includes("posted using [inleo") === false).filter((item) => item.toLowerCase().includes("posted using [sportstalksocial]") === false).filter((item) => item.toLowerCase().includes("<center><sub>[posted using aeneas.blog") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [proofofbrain.io") === false).filter((item) => item.toLowerCase().includes("<center>posted on [hypnochain") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [weedcash.network") === false).filter((item) => item.toLowerCase().includes("<center>posted on [naturalmedicine.io") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [musicforlife.io") === false).filter((item) => item.toLowerCase().includes("if the truvvl embed is unsupported by your current frontend, click this link to view this story") === false).filter((item) => item.toLowerCase().includes("<center><em>posted from truvvl") === false).filter((item) => item.toLowerCase().includes('view this post <a href="https://travelfeed.io/') === false).filter((item) => item.toLowerCase().includes("read this post on travelfeed.io for the best experience") === false).filter((item) => item.toLowerCase().includes('posted via <a href="https://www.dporn.co/"') === false).filter((item) => item.toLowerCase().includes("\u25B6\uFE0F [watch on 3speak](https://3speak") === false).filter((item) => item.toLowerCase().includes("<sup><sub>posted via [inji.com]") === false).filter((item) => item.toLowerCase().includes("view this post on [liketu]") === false).filter((item) => {
|
|
1885
|
+
const l = item.toLowerCase();
|
|
1886
|
+
return !(l.includes("posted from liketu speak") && l.includes("auto-transcrib"));
|
|
1887
|
+
}).filter((item) => item.toLowerCase().includes("[via Inbox]") === false).filter((item) => item.toLowerCase().includes("<sub>[via apps from](") === false).join("\n") : "").replace('Posted via <a href="https://d.buzz" data-link="promote-link">D.Buzz</a>', "").replace('<div class="pull-right"><a href="/@hive.engage"></a></div>', "").replace('<div><a href="https://engage.hivechain.app"></a></div>', "").replace(`<div class="text-center"><img src="https://cdn.steemitimages.com/DQmNp6YwAm2qwquALZw8PdcovDorwaBSFuxQ38TrYziGT6b/A-20.png"><a href="https://bit.ly/actifit-app"><img src="https://cdn.steemitimages.com/DQmQqfpSmcQtfrHAtzfBtVccXwUL9vKNgZJ2j93m8WNjizw/l5.png"></a><a href="https://bit.ly/actifit-ios"><img src="https://cdn.steemitimages.com/DQmbWy8KzKT1UvCvznUTaFPw6wBUcyLtBT5XL9wdbB7Hfmn/l6.png"></a></div>`, "");
|
|
1868
1888
|
}
|
|
1869
1889
|
var domSerializer = domSerializerModule.default || domSerializerModule;
|
|
1870
1890
|
var lolightPromise = null;
|