egirlskey/src/server/activitypub/publickey.ts

20 lines
524 B
TypeScript
Raw Normal View History

2018-04-01 11:07:04 +00:00
import * as express from 'express';
2018-04-01 19:15:27 +00:00
import context from '../../remote/activitypub/renderer/context';
import render from '../../remote/activitypub/renderer/key';
2018-04-02 04:15:53 +00:00
import config from '../../config';
2018-04-01 11:07:04 +00:00
import withUser from './with-user';
const app = express();
app.disable('x-powered-by');
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;