diff --git a/routes/api.js b/routes/api.js index ecea484..448321c 100644 --- a/routes/api.js +++ b/routes/api.js @@ -36,6 +36,7 @@ router.get('/convert', function (req, res) { console.log('end!!!!'); res.status(200).json(feedData); let displayName = feedData.title; + let description = feedData.description; let account = username; // create new user let db = req.app.get('db'); @@ -43,7 +44,7 @@ router.get('/convert', function (req, res) { // create keypair var pair = generateRSAKeypair(); getImage(feed, feedData, imageUrl => { - let actorRecord = createActor(account, domain, pair.public, displayName, imageUrl); + let actorRecord = createActor(account, domain, pair.public, displayName, imageUrl, description); let webfingerRecord = createWebfinger(account, domain); const apikey = crypto.randomBytes(16).toString('hex'); db.prepare('insert or replace into accounts(name, actor, apikey, pubkey, privkey, webfinger) values(?, ?, ?, ?, ?, ?)').run( `${account}@${domain}`, JSON.stringify(actorRecord), apikey, pair.public, pair.private, JSON.stringify(webfingerRecord)); @@ -81,7 +82,7 @@ function getImage(feed, feedData, cb) { } } -function createActor(name, domain, pubkey, displayName, imageUrl) { +function createActor(name, domain, pubkey, displayName, imageUrl, description) { displayName = displayName || name; let actor = { '@context': [ @@ -107,6 +108,9 @@ function createActor(name, domain, pubkey, displayName, imageUrl) { 'url': imageUrl, }; } + if (description) { + actor.summary = `
${description}
`; + } return actor; } diff --git a/routes/user.js b/routes/user.js index 073fbf1..50faf30 100644 --- a/routes/user.js +++ b/routes/user.js @@ -31,7 +31,11 @@ router.get('/:name', function (req, res) { if (actor.icon && actor.icon.url) { imageUrl = actor.icon.url; } - res.render('user', { displayName: actor.name, items: feedData.items, accountName: '@'+name, imageUrl: imageUrl }); + let description = null; + if (actor.summary) { + description = actor.summary; + } + res.render('user', { displayName: actor.name, items: feedData.items, accountName: '@'+name, imageUrl: imageUrl, description }); } } }); diff --git a/views/user.pug b/views/user.pug index f465de9..dd3409e 100644 --- a/views/user.pug +++ b/views/user.pug @@ -7,8 +7,9 @@ html body h1= displayName img(src=imageUrl) - p.account #{accountName} - 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! + h3.account #{accountName} + p #{description} + 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! h2 Feed items ul for item in items