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

21 lines
505 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 14:15:27 -05:00
import config from '../../../conf';
2018-04-01 05:18:36 -05:00
export default user => {
const id = `${config.url}/@${user.username}`;
return {
type: 'Person',
id,
inbox: `${id}/inbox`,
outbox: `${id}/outbox`,
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)
};
};