@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.
@@ -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\/[^/?#]+(?:$|[?#])/i;
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;
@@ -1205,12 +1205,28 @@ function linkify(content, forApp) {
1205
1205
  }
1206
1206
  );
1207
1207
  content = content.replace(
1208
- /((^|\s)(\/|)@[\w.\d-]+)\/(\S+)/gi,
1209
- (match, u, p1, p2, p3) => {
1208
+ /(^|\s)\/([a-z0-9-]+)\/@([\w.\d-]+)\/(\S+)/gi,
1209
+ (match, preceding, tag, author, p3) => {
1210
+ const authorLower = author.toLowerCase();
1211
+ if (!isValidUsername(authorLower)) return match;
1212
+ const permlink = sanitizePermlink(p3);
1213
+ if (!isValidPermlink(permlink)) return match;
1214
+ if (SECTION_LIST.includes(permlink)) {
1215
+ const attrs = forApp ? `href="https://ecency.com/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
1216
+ return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
1217
+ } else {
1218
+ const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/${tag}/@${authorLower}/${permlink}"`;
1219
+ return `${preceding}<a class="markdown-post-link" ${attrs}>@${authorLower}/${permlink}</a>`;
1220
+ }
1221
+ }
1222
+ );
1223
+ content = content.replace(
1224
+ /((^|\s)\/@[\w.\d-]+)\/(\S+)/gi,
1225
+ (match, u, _p1, p3) => {
1210
1226
  const uu = u.trim().toLowerCase().replace("/@", "").replace("@", "");
1211
1227
  const permlink = sanitizePermlink(p3);
1212
1228
  if (!isValidPermlink(permlink)) return match;
1213
- if (SECTION_LIST.some((v) => p3.includes(v))) {
1229
+ if (SECTION_LIST.includes(permlink)) {
1214
1230
  const attrs = forApp ? `href="https://ecency.com/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
1215
1231
  return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
1216
1232
  } else {