Implement account public key endpoint

This commit is contained in:
Akihiko Odaki
2018-04-01 20:07:04 +09:00
parent a3cef6e9b5
commit cba73d6bc1
6 changed files with 66 additions and 52 deletions

View File

@@ -0,0 +1,19 @@
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;