Use id in uri instead of username
This commit is contained in:
parent
1fced8a59b
commit
e63f884bc6
14 changed files with 52 additions and 87 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue