Use id in uri instead of username
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import * as express from 'express';
|
||||
import context from '../../remote/activitypub/renderer/context';
|
||||
import render from '../../remote/activitypub/renderer/key';
|
||||
import config from '../../config';
|
||||
import withUser from './with-user';
|
||||
import User from '../../models/user';
|
||||
|
||||
const app = express.Router();
|
||||
|
||||
app.get('/@:user/publickey', withUser(username => {
|
||||
return `${config.url}/@${username}/publickey`;
|
||||
}, (user, req, res) => {
|
||||
app.get('/users/:user/publickey', async (req, res) => {
|
||||
const userId = req.params.user;
|
||||
|
||||
const user = await User.findOne({ _id: userId });
|
||||
|
||||
const rendered = render(user);
|
||||
rendered['@context'] = context;
|
||||
|
||||
res.json(rendered);
|
||||
}));
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user