Implement ActivityPub Followers/Following/Outbox
This commit is contained in:
parent
58d0ed1a2e
commit
0986301788
7 changed files with 321 additions and 70 deletions
16
src/remote/activitypub/renderer/follow-user.ts
Normal file
16
src/remote/activitypub/renderer/follow-user.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import config from '../../../config';
|
||||
import * as mongo from 'mongodb';
|
||||
import User, { isLocalUser } from '../../../models/user';
|
||||
|
||||
/**
|
||||
* Convert (local|remote)(Follower|Followee)ID to URL
|
||||
* @param id Follower|Followee ID
|
||||
*/
|
||||
export default async function renderFollowUser(id: mongo.ObjectID): Promise<any> {
|
||||
|
||||
const user = await User.findOne({
|
||||
_id: id
|
||||
});
|
||||
|
||||
return isLocalUser(user) ? `${config.url}/users/${user._id}` : user.uri;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue