Use id in uri instead of username

This commit is contained in:
syuilo
2018-04-08 15:15:22 +09:00
parent 1fced8a59b
commit e63f884bc6
14 changed files with 52 additions and 87 deletions

View File

@ -3,6 +3,6 @@ import { IRemoteUser, ILocalUser } from '../../../models/user';
export default (follower: ILocalUser, followee: IRemoteUser) => ({
type: 'Follow',
actor: `${config.url}/@${follower.username}`,
actor: `${config.url}/users/${follower._id}`,
object: followee.uri
});

View File

@ -3,8 +3,8 @@ import { extractPublic } from '../../../crypto_key';
import { ILocalUser } from '../../../models/user';
export default (user: ILocalUser) => ({
id: `${config.url}/@${user.username}/publickey`,
id: `${config.url}/users/${user._id}/publickey`,
type: 'Key',
owner: `${config.url}/@${user.username}`,
owner: `${config.url}/users/${user._id}`,
publicKeyPem: extractPublic(user.keypair)
});

View File

@ -1,10 +1,8 @@
import config from '../../../config';
import { ILocalUser } from '../../../models/user';
export default (user: ILocalUser, note) => {
return {
type: 'Like',
actor: `${config.url}/@${user.username}`,
object: note.uri ? note.uri : `${config.url}/notes/${note._id}`
};
};
export default (user: ILocalUser, note) => ({
type: 'Like',
actor: `${config.url}/users/${user._id}`,
object: note.uri ? note.uri : `${config.url}/notes/${note._id}`
});

View File

@ -34,7 +34,7 @@ export default async (note: INote) => {
_id: note.userId
});
const attributedTo = `${config.url}/@${user.username}`;
const attributedTo = `${config.url}/users/${user._id}`;
return {
id: `${config.url}/notes/${note._id}`,

View File

@ -3,7 +3,7 @@ import renderKey from './key';
import config from '../../../config';
export default user => {
const id = `${config.url}/@${user.username}`;
const id = `${config.url}/users/${user._id}`;
return {
type: 'Person',