Sharkey/src/server/activitypub/publickey.ts

19 lines
502 B
TypeScript
Raw Normal View History

2018-04-01 14:07:04 +03:00
import * as express from 'express';
2018-04-01 22:15:27 +03:00
import context from '../../remote/activitypub/renderer/context';
import render from '../../remote/activitypub/renderer/key';
2018-04-02 07:15:53 +03:00
import config from '../../config';
2018-04-01 14:07:04 +03:00
import withUser from './with-user';
2018-04-05 11:52:46 +03:00
const app = express.Router();
2018-04-01 14:07:04 +03:00
app.get('/@:user/publickey', withUser(username => {
return `${config.url}/@${username}/publickey`;
}, (user, req, res) => {
const rendered = render(user);
rendered['@context'] = context;
res.json(rendered);
}));
export default app;