yumechi-no-kuni/src/remote/activitypub/renderer/person.ts

25 lines
696 B
TypeScript
Raw Normal View History

2018-04-01 05:18:36 -05:00
import renderImage from './image';
import renderKey from './key';
2018-04-01 23:15:53 -05:00
import config from '../../../config';
2018-05-31 04:34:15 -05:00
import { ILocalUser } from '../../../models/user';
2018-04-01 05:18:36 -05:00
2018-05-31 04:34:15 -05:00
export default (user: ILocalUser) => {
2018-04-08 01:15:22 -05:00
const id = `${config.url}/users/${user._id}`;
2018-04-01 05:18:36 -05:00
return {
type: 'Person',
id,
inbox: `${id}/inbox`,
outbox: `${id}/outbox`,
2018-04-23 01:37:27 -05:00
sharedInbox: `${config.url}/inbox`,
2018-04-08 04:21:02 -05:00
url: `${config.url}/@${user.username}`,
2018-04-01 05:18:36 -05:00
preferredUsername: user.username,
name: user.name,
summary: user.description,
icon: user.avatarId && renderImage({ _id: user.avatarId }),
image: user.bannerId && renderImage({ _id: user.bannerId }),
2018-05-31 04:34:15 -05:00
manuallyApprovesFollowers: user.isLocked,
2018-04-01 05:18:36 -05:00
publicKey: renderKey(user)
};
};