add mentions and tags

This commit is contained in:
biglyderv 2025-03-04 00:37:47 -05:00
parent c780197d35
commit f7c948b4ac
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
2 changed files with 18 additions and 0 deletions

14
lib.js
View file

@ -22,6 +22,20 @@ function splitUp(content) {
out[i] = ['link',res];
continue;
}
let urlThing = "";
if (res[0] == '@' || res[0] == '#') {
let type = res[0] == '@' ? '/users/' : '/walls/get/hub/';
let type2 = res[0] == '@' ? '' : '/0';
urlThing = new URL(type + res.slice(1) + type2, 'https://tbg.dervland.net/').pathname
}
if (res[0] == '@') {
out[i] = ['curl',res, urlThing];
continue;
}
if (res[0] == '#') {
out[i] = ['curl',res, urlThing];
continue;
}
out[i] = [res];
}
return out;

View file

@ -23,6 +23,8 @@
</a>
<% } else if (contentN[0] == 'link') { %>
<a class='link' href='<%= contentN[1] %>'><%= contentN[1] %></a>
<% } else if (contentN[0] == 'curl') { %>
<a class='link' href='<%= contentN[2] %>'><%= contentN[1] %></a>
<% } else if (contentN[0].replaceAll(' ','').length > 0) { %>
<span class='commentbox'><%= contentN[0] %></span>
<% } } %>
@ -30,6 +32,8 @@
<% if (!isNaN(date * 1)) { %>
<div class='sub'><b>Posted on</b> <%= new Date(date).toISOString() %> </div>
<% } %>
<% if (type != 'hub') { %>
<%- include ('vblock.ejs', {link: `/${type}/${id}`, icon: '/icon.svg', name: 'Original'}) %>
<% } %>
<%- include ('vblock.ejs', {link: `/walls/get/${type}/${id}/0`, icon: '/walls.svg', name: 'Replies'}) %>
</div>