mizzkey/src/server/activitypub/publickey.ts

20 lines
536 B
TypeScript
Raw Normal View History

2018-04-01 13:07:04 +02:00
import * as express from 'express';
import context from '../../common/remote/activitypub/renderer/context';
import render from '../../common/remote/activitypub/renderer/key';
import config from '../../conf';
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;