@ecency/render-helper 2.4.23 → 2.4.24
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 +20 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +20 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +20 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -75,7 +75,7 @@ var TWITCH_REGEX = /https?:\/\/(?:www.)?twitch.tv\/(?:(videos)\/)?([a-zA-Z0-9][\
|
|
|
75
75
|
var DAPPLR_REGEX = /^(https?:)?\/\/[a-z]*\.dapplr.in\/file\/dapplr-videos\/.*/i;
|
|
76
76
|
var TRUVVL_REGEX = /^https?:\/\/embed.truvvl.com\/(@[\w.\d-]+)\/(.*)/i;
|
|
77
77
|
var LBRY_REGEX = /^(https?:)?\/\/lbry.tv\/\$\/embed\/[^?#]+(?:$|[?#])/i;
|
|
78
|
-
var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[
|
|
78
|
+
var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[^?#]+(?:$|[?#])/i;
|
|
79
79
|
var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
|
|
80
80
|
var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
|
|
81
81
|
var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak\.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak\.([a-z]+)\/embed\?v=))([A-Za-z0-9_\-\.\/]+)(&.*)?/i;
|
|
@@ -1208,12 +1208,28 @@ function linkify(content, forApp) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
);
|
|
1210
1210
|
content = content.replace(
|
|
1211
|
-
/(
|
|
1212
|
-
(match,
|
|
1211
|
+
/(^|\s)\/([a-z0-9-]+)\/@([\w.\d-]+)\/(\S+)/gi,
|
|
1212
|
+
(match, preceding, tag, author, p3) => {
|
|
1213
|
+
const authorLower = author.toLowerCase();
|
|
1214
|
+
if (!isValidUsername(authorLower)) return match;
|
|
1215
|
+
const permlink = sanitizePermlink(p3);
|
|
1216
|
+
if (!isValidPermlink(permlink)) return match;
|
|
1217
|
+
if (SECTION_LIST.includes(permlink)) {
|
|
1218
|
+
const attrs = forApp ? `href="https://ecency.com/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
1219
|
+
return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1220
|
+
} else {
|
|
1221
|
+
const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/${tag}/@${authorLower}/${permlink}"`;
|
|
1222
|
+
return `${preceding}<a class="markdown-post-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
);
|
|
1226
|
+
content = content.replace(
|
|
1227
|
+
/((^|\s)\/@[\w.\d-]+)\/(\S+)/gi,
|
|
1228
|
+
(match, u, _p1, p3) => {
|
|
1213
1229
|
const uu = u.trim().toLowerCase().replace("/@", "").replace("@", "");
|
|
1214
1230
|
const permlink = sanitizePermlink(p3);
|
|
1215
1231
|
if (!isValidPermlink(permlink)) return match;
|
|
1216
|
-
if (SECTION_LIST.
|
|
1232
|
+
if (SECTION_LIST.includes(permlink)) {
|
|
1217
1233
|
const attrs = forApp ? `href="https://ecency.com/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
1218
1234
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
|
|
1219
1235
|
} else {
|