1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Avoid too many requests and fetching outbox

This commit is contained in:
Chocobozzz 2018-01-18 14:59:27 +01:00
parent f05a1c30c1
commit 54e740594b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 72 additions and 20 deletions

View file

@ -143,6 +143,10 @@ async function getActorsInvolvedInVideo (video: VideoModel, t: Transaction) {
async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {
const followerInboxUrls = await actorSender.getFollowerSharedInboxUrls(t)
return buildAudience(followerInboxUrls, isPublic)
}
function buildAudience (followerInboxUrls: string[], isPublic = true) {
// Thanks Mastodon: https://github.com/tootsuite/mastodon/blob/master/app/lib/activitypub/tag_manager.rb#L47
let to = []
let cc = []
@ -183,6 +187,7 @@ async function computeUris (toActors: ActorModel[], actorsException: ActorModel[
export {
broadcastToFollowers,
unicastTo,
buildAudience,
getAudience,
getOriginVideoAudience,
getActorsInvolvedInVideo,