41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
const express = require('express');
|
|
const { getKeyPair } = require('../lib/keys');
|
|
|
|
module.exports = {
|
|
/**
|
|
* @param {express.IRoute} routeObj
|
|
*/
|
|
route: (routeObj) => {
|
|
routeObj.get((req, res, _next) => {
|
|
res.setHeader('content-type', 'application/activity+json');
|
|
res.json({
|
|
'@context': [
|
|
'https://www.w3.org/ns/activitystreams',
|
|
{
|
|
security: 'https://w3id.org/security#'
|
|
}
|
|
],
|
|
'id': `https://${req.hostname}/actor`,
|
|
'type': 'Application',
|
|
'inbox': `https://${req.hostname}/actor/inbox`,
|
|
'security:publicKey': {
|
|
'id': `https://${req.hostname}/actor#main-key`,
|
|
'security:owner': {
|
|
id: `https://${req.hostname}/actor`
|
|
},
|
|
'security:publicKeyPem': getKeyPair(`https://${req.hostname}/actor`)
|
|
},
|
|
'endpoints': {
|
|
sharedInbox: `https://${req.hostname}/inbox`
|
|
},
|
|
'as:manuallyApprovesFollowers': true,
|
|
'outbox': `https://${req.hostname}/actor/outbox`,
|
|
'preferredUsername': `${req.hostname}`,
|
|
'url': `https://${req.hostname}/about/more?instance_actor=true`
|
|
});
|
|
return res.end();
|
|
});
|
|
}
|
|
};
|