Make post replacements on pages.meet more stable

This commit is contained in:
Niko 2022-02-17 22:11:20 +01:00
parent 5bd19dcc18
commit ab8db4cf83
1 changed files with 6 additions and 3 deletions

View File

@ -134,8 +134,10 @@ app.post = {
const ps = acct.split('@'); const ps = acct.split('@');
const link = '<a class="mention" href="'+htmlescape(href)+'">@'+ const link = '<a class="mention" href="'+htmlescape(href)+'">@'+
htmlescape(acct) + '</a>'; htmlescape(acct) + '</a>';
replaceAfter.push(['@'+ps[0], link]); value = value.replaceAll('@'+ps[0], '@\\'+ps[0]);
replaceAfter.push(['@'+acct, link]); value = value.replaceAll('@'+acct, '@\\'+acct);
replaceAfter.push(['@\\'+ps[0], link]);
replaceAfter.push(['@\\'+acct, link]);
} else if (tags[i].type.toLowerCase().includes('hashtag')) { } else if (tags[i].type.toLowerCase().includes('hashtag')) {
var hash = tags[i].name; var hash = tags[i].name;
var href = tags[i].href; var href = tags[i].href;
@ -145,7 +147,8 @@ app.post = {
continue; continue;
const link = '<a class="hashtag" href="'+htmlescape(href)+'">'+ const link = '<a class="hashtag" href="'+htmlescape(href)+'">'+
htmlescape(hash) + '</a>'; htmlescape(hash) + '</a>';
replaceAfter.push([hash, link]); value = value.replaceAll(hash, '\\'+hash);
replaceAfter.push(['\\'+hash, link]);
} }
} }
value = html2text(value); value = html2text(value);