Refactored embeds to be more useful on discord

This commit is contained in:
Jemma
2023-12-29 18:04:22 -06:00
parent caf5738fae
commit 1d16b4c176
3 changed files with 16 additions and 11 deletions

View File

@@ -113,6 +113,7 @@ router.get('/:post_id', async function (req, res) {
const community = await database.getCommunityByID(post.community_id);
const communityMap = await util.data.getCommunityHash();
const replies = await database.getPostReplies(req.params.post_id.toString(), 25);
const postPNID = await util.data.getUserDataFromPid(post.pid);
res.render(req.directory + '/post.ejs', {
moment: moment,
userSettings: userSettings,
@@ -125,6 +126,7 @@ router.get('/:post_id', async function (req, res) {
lang: req.lang,
mii_image_CDN: config.mii_image_CDN,
pid: req.pid,
postPNID,
moderator: req.moderator
});
});

View File

@@ -135,10 +135,9 @@ router.get('/notifications.json', async function (req, res) {
router.get('/:post_id/oembed.json', async function (req, res) {
const post = await database.getPostByID(req.params.post_id.toString());
const user = await database.getUserByPID(post.pid);
const doc = {
'author_name': user.user_id,
'author_url': 'https://portal.olv.pretendo.cc/users/show?pid=' + user.pid,
'author_name': post.screen_name,
'author_url': 'https://juxt.pretendo.network/users/show?pid=' + post.pid,
};
res.send(doc);
});

View File

@@ -3,8 +3,10 @@
<title>Post by <%= post.screen_name %></title>
<%- include('partials/head'); %>
<!-- Google / Search Engine Tags -->
<meta itemprop="name" content="Juxtaposition - Post by <%= post.screen_name %>">
<meta itemprop="description" content="<%= community.name %> - <%= post.empathy_count%> Yeahs!">
<meta itemprop="name" content="<%= post.screen_name %> (@<%= postPNID.username %>) - <%= community.name %>">
<meta itemprop="description" content="<%= post.body %>
<%= post.reply_count %> 🗨️ <%= post.empathy_count %> ❤️">
<% if(post.screenshot !== '') { %>
<meta itemprop="image" content="https://pretendo-cdn.b-cdn.net<%= post.screenshot %>">
<%} else if(post.painting !== '') { %>
@@ -12,13 +14,15 @@
<%}%>
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="Juxt - Post by <%= post.screen_name %>"/>
<meta property="og:description" content="<%= community.name %> - <%= post.empathy_count%> Yeahs!"/>
<meta property="og:title" content="<%= post.screen_name %> (@<%= postPNID.username %>) - <%= community.name %>"/>
<meta property="og:description" content="<%= post.body %>
<%= post.reply_count %> 🗨️ <%= post.empathy_count %> ❤️"/>
<meta property="og:url" content="https://juxt.pretendo.cc/posts/<%= post.id %>"/>
<% if(post.screenshot !== '') { %>
<meta property="og:image" content="https://pretendo-cdn.b-cdn.net/<%= post.screenshot %>"/>
<meta property="og:image" content="https://pretendo-cdn.b-cdn.net<%= post.screenshot %>"/>
<%} else if(post.painting !== '') { %>
<meta property="og:image" content="https://pretendo-cdn.b-cdn.net/paintings/<%= post.pid %>/<%= post.id %>.png"/>
<meta property="og:image" content="https://pretendo-cdn.b-cdn.net/paintings/<%= post.pid %>/<%= post.id %>.png"/>
<%}%>
<meta property="og:site_name" content="Juxtaposition" />
@@ -28,9 +32,9 @@
<meta name="twitter:description" content="<%= community.name %> - <%= post.empathy_count%> Yeahs!"/>
<meta name="twitter:site" content="@PretendoNetwork"/>
<% if(post.screenshot !== '') { %>
<meta name="twitter:image" content="https://pretendo-cdn.b-cdn.net/<%= post.screenshot %>"/>
<meta name="twitter:image" content="https://pretendo-cdn.b-cdn.net<%= post.screenshot %>"/>
<%} else if(post.painting !== '') { %>
<meta name="twitter:image" content="https://pretendo-cdn.b-cdn.net/paintings/<%= post.pid %>/<%= post.id %>.png"/>
<meta name="twitter:image" content="https://pretendo-cdn.b-cdn.net/paintings/<%= post.pid %>/<%= post.id %>.png"/>
<%}%>
<meta name="twitter:creator" content="@PretendoNetwork"/>