@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.cjs
CHANGED
|
@@ -104,7 +104,7 @@ var TWITCH_REGEX = /https?:\/\/(?:www.)?twitch.tv\/(?:(videos)\/)?([a-zA-Z0-9][\
|
|
|
104
104
|
var DAPPLR_REGEX = /^(https?:)?\/\/[a-z]*\.dapplr.in\/file\/dapplr-videos\/.*/i;
|
|
105
105
|
var TRUVVL_REGEX = /^https?:\/\/embed.truvvl.com\/(@[\w.\d-]+)\/(.*)/i;
|
|
106
106
|
var LBRY_REGEX = /^(https?:)?\/\/lbry.tv\/\$\/embed\/[^?#]+(?:$|[?#])/i;
|
|
107
|
-
var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[
|
|
107
|
+
var ODYSEE_REGEX = /^(https?:)?\/\/odysee\.com\/(?:\$|%24)\/embed\/[^?#]+(?:$|[?#])/i;
|
|
108
108
|
var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
|
|
109
109
|
var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
|
|
110
110
|
var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak\.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak\.([a-z]+)\/embed\?v=))([A-Za-z0-9_\-\.\/]+)(&.*)?/i;
|
|
@@ -1237,12 +1237,28 @@ function linkify(content, forApp) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
);
|
|
1239
1239
|
content = content.replace(
|
|
1240
|
-
/(
|
|
1241
|
-
(match,
|
|
1240
|
+
/(^|\s)\/([a-z0-9-]+)\/@([\w.\d-]+)\/(\S+)/gi,
|
|
1241
|
+
(match, preceding, tag, author, p3) => {
|
|
1242
|
+
const authorLower = author.toLowerCase();
|
|
1243
|
+
if (!isValidUsername(authorLower)) return match;
|
|
1244
|
+
const permlink = sanitizePermlink(p3);
|
|
1245
|
+
if (!isValidPermlink(permlink)) return match;
|
|
1246
|
+
if (SECTION_LIST.includes(permlink)) {
|
|
1247
|
+
const attrs = forApp ? `href="https://ecency.com/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
1248
|
+
return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1249
|
+
} else {
|
|
1250
|
+
const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/${tag}/@${authorLower}/${permlink}"`;
|
|
1251
|
+
return `${preceding}<a class="markdown-post-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
);
|
|
1255
|
+
content = content.replace(
|
|
1256
|
+
/((^|\s)\/@[\w.\d-]+)\/(\S+)/gi,
|
|
1257
|
+
(match, u, _p1, p3) => {
|
|
1242
1258
|
const uu = u.trim().toLowerCase().replace("/@", "").replace("@", "");
|
|
1243
1259
|
const permlink = sanitizePermlink(p3);
|
|
1244
1260
|
if (!isValidPermlink(permlink)) return match;
|
|
1245
|
-
if (SECTION_LIST.
|
|
1261
|
+
if (SECTION_LIST.includes(permlink)) {
|
|
1246
1262
|
const attrs = forApp ? `href="https://ecency.com/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
1247
1263
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
|
|
1248
1264
|
} else {
|