summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/renderer/person.ts
blob: 424305f8d383b5a6e0a17a1fa28e381279318e49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import renderImage from './image';
import renderKey from './key';
import config from '../../../config';

export default user => {
	const id = `${config.url}/users/${user._id}`;

	return {
		type: 'Person',
		id,
		inbox: `${id}/inbox`,
		outbox: `${id}/outbox`,
		sharedInbox: `${config.url}/inbox`,
		url: `${config.url}/@${user.username}`,
		preferredUsername: user.username,
		name: user.name,
		summary: user.description,
		icon: user.avatarId && renderImage({ _id: user.avatarId }),
		image: user.bannerId && renderImage({ _id: user.bannerId }),
		publicKey: renderKey(user)
	};
};