Add feed URL to user page

Closes #18.
This commit is contained in:
Darius Kazemi 2019-03-08 22:29:28 -08:00
parent 4888db441c
commit 609c640fc4
2 changed files with 6 additions and 4 deletions

View File

@ -21,11 +21,12 @@ router.get('/:name', function (req, res) {
else { else {
let actor = JSON.parse(result.actor); let actor = JSON.parse(result.actor);
let username = name.replace('@'+domain,''); let username = name.replace('@'+domain,'');
let content = db.prepare('select content from feeds where username = ?').get(username); let resultFeed = db.prepare('select content, feed from feeds where username = ?').get(username);
if (content === undefined) { if (resultFeed === undefined) {
return res.status(404).json(`Something went very wrong!`); 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; let imageUrl = null;
// if image exists set image // if image exists set image
if (actor.icon && actor.icon.url) { if (actor.icon && actor.icon.url) {
@ -35,7 +36,7 @@ router.get('/:name', function (req, res) {
if (actor.summary) { if (actor.summary) {
description = 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 });
} }
} }
}); });

View File

@ -10,6 +10,7 @@ html
img(src=imageUrl) img(src=imageUrl)
h3.account #{accountName} h3.account #{accountName}
p #{description} p #{description}
p <a href="#{feedUrl}">#{feedUrl}</a>
p <strong><em>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! <a href="/convert/">Click here to make an ActivityPub account for your favorite RSS feeds</a>.</em></strong> p <strong><em>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! <a href="/convert/">Click here to make an ActivityPub account for your favorite RSS feeds</a>.</em></strong>
h2 Feed items h2 Feed items
ul ul