diff options
author | Darius Kazemi <darius.kazemi@gmail.com> | 2020-01-06 23:29:24 -0800 |
---|---|---|
committer | Darius Kazemi <darius.kazemi@gmail.com> | 2020-01-06 23:29:24 -0800 |
commit | 5ffe6115740cfa293322e1961e7c9996e32ce2a4 (patch) | |
tree | baae6484940c790bf560b32ee0cd4daa997502a5 | |
parent | f5178f1a663c721c910b793a2dfd5b2cc6ce9e76 (diff) |
move function to activitypub file
-rw-r--r-- | activitypub.js | 15 | ||||
-rwxr-xr-x | routes.js | 20 |
2 files changed, 16 insertions, 19 deletions
diff --git a/activitypub.js b/activitypub.js index 5940ac0..983738b 100644 --- a/activitypub.js +++ b/activitypub.js @@ -884,6 +884,20 @@ function processInbox(req, res) { } } +function createWebfinger(eventID, domain) { + return { + 'subject': `acct:${eventID}@${domain}`, + + 'links': [ + { + 'rel': 'self', + 'type': 'application/activity+json', + 'href': `https://${domain}/${eventID}` + } + ] + }; +} + module.exports = { processInbox, sendAcceptMessage, @@ -898,4 +912,5 @@ module.exports = { createActivityPubEvent, updateActivityPubEvent, createFeaturedPost, + createWebfinger, } @@ -132,24 +132,6 @@ const deleteOldEvents = schedule.scheduleJob('59 23 * * *', function(fireDate){ }); }); - -// ACTIVITYPUB HELPER FUNCTIONS -function createWebfinger(eventID, domain) { - return { - 'subject': `acct:${eventID}@${domain}`, - - 'links': [ - { - 'rel': 'self', - 'type': 'application/activity+json', - 'href': `https://${domain}/${eventID}` - } - ] - }; -} - - - // FRONTEND ROUTES router.get('/', (req, res) => { @@ -278,7 +260,7 @@ router.get('/.well-known/webfinger', (req, res) => { res.render('404', { url: req.url }); } else { - res.json(createWebfinger(eventID, domain)); + res.json(ap.createWebfinger(eventID, domain)); } }) .catch((err) => { |