From 609c640fc4e1235af880d3d929778e95d332d133 Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Fri, 8 Mar 2019 22:29:28 -0800 Subject: [PATCH] Add feed URL to user page Closes #18. --- routes/user.js | 9 +++++---- views/user.pug | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/routes/user.js b/routes/user.js index 50faf30..25b1e94 100644 --- a/routes/user.js +++ b/routes/user.js @@ -21,11 +21,12 @@ router.get('/:name', function (req, res) { else { let actor = JSON.parse(result.actor); let username = name.replace('@'+domain,''); - let content = db.prepare('select content from feeds where username = ?').get(username); - if (content === undefined) { + let resultFeed = db.prepare('select content, feed from feeds where username = ?').get(username); + if (resultFeed === undefined) { return res.status(404).json(`Something went very wrong!`); } - let feedData = JSON.parse(content.content); + let feedData = JSON.parse(resultFeed.content); + let feedUrl = resultFeed.feed; let imageUrl = null; // if image exists set image if (actor.icon && actor.icon.url) { @@ -35,7 +36,7 @@ router.get('/:name', function (req, res) { if (actor.summary) { description = actor.summary; } - res.render('user', { displayName: actor.name, items: feedData.items, accountName: '@'+name, imageUrl: imageUrl, description }); + res.render('user', { displayName: actor.name, items: feedData.items, accountName: '@'+name, imageUrl: imageUrl, description, feedUrl }); } } }); diff --git a/views/user.pug b/views/user.pug index fc6eb5d..4cfddfb 100644 --- a/views/user.pug +++ b/views/user.pug @@ -10,6 +10,7 @@ html img(src=imageUrl) h3.account #{accountName} p #{description} + p #{feedUrl} p What you're looking at is an RSS feed that's been converted into an account that Mastodon (or any other ActivityPub social network) can subscribe to. Put the username above into your user search and you should be able to find this feed and subscribe! Click here to make an ActivityPub account for your favorite RSS feeds. h2 Feed items ul