Implement ActivityPub Followers/Following/Outbox

This commit is contained in:
mei23
2018-08-14 20:13:32 +09:00
parent 58d0ed1a2e
commit 0986301788
7 changed files with 321 additions and 70 deletions

View 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;
}