aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-25 11:17:41 +0200
committerChocobozzz <me@florianbigard.com>2018-05-25 11:17:41 +0200
commit16f29007dc6ad9c539195d7a7c1cde45d626ce91 (patch)
tree1f0efc5ebd80f9ad69f69b2998c25f27dbfb844e
parentad9e39fb815d85e5e718c40540fa75471474fa17 (diff)
downloadPeerTube-16f29007dc6ad9c539195d7a7c1cde45d626ce91.tar.gz
PeerTube-16f29007dc6ad9c539195d7a7c1cde45d626ce91.tar.zst
PeerTube-16f29007dc6ad9c539195d7a7c1cde45d626ce91.zip
Fix cc field in classic audience
-rw-r--r--server/lib/activitypub/actor.ts20
-rw-r--r--server/lib/activitypub/fetch.ts23
-rw-r--r--server/lib/activitypub/process/process-accept.ts2
-rw-r--r--server/lib/activitypub/send/misc.ts4
4 files changed, 21 insertions, 28 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 4c336f26e..f27733418 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -19,6 +19,8 @@ import { ActorModel } from '../../models/activitypub/actor'
19import { AvatarModel } from '../../models/avatar/avatar' 19import { AvatarModel } from '../../models/avatar/avatar'
20import { ServerModel } from '../../models/server/server' 20import { ServerModel } from '../../models/server/server'
21import { VideoChannelModel } from '../../models/video/video-channel' 21import { VideoChannelModel } from '../../models/video/video-channel'
22import { JobQueue } from '../job-queue'
23import { getServerActor } from '../../helpers/utils'
22 24
23// Set account keys, this could be long so process after the account creation and do not block the client 25// Set account keys, this could be long so process after the account creation and do not block the client
24function setAsyncActorKeys (actor: ActorModel) { 26function setAsyncActorKeys (actor: ActorModel) {
@@ -169,6 +171,21 @@ async function fetchAvatarIfExists (actorJSON: ActivityPubActor) {
169 return undefined 171 return undefined
170} 172}
171 173
174async function addFetchOutboxJob (actor: ActorModel) {
175 // Don't fetch ourselves
176 const serverActor = await getServerActor()
177 if (serverActor.id === actor.id) {
178 logger.error('Cannot fetch our own outbox!')
179 return undefined
180 }
181
182 const payload = {
183 uris: [ actor.outboxUrl ]
184 }
185
186 return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })
187}
188
172export { 189export {
173 getOrCreateActorAndServerAndModel, 190 getOrCreateActorAndServerAndModel,
174 buildActorInstance, 191 buildActorInstance,
@@ -176,7 +193,8 @@ export {
176 fetchActorTotalItems, 193 fetchActorTotalItems,
177 fetchAvatarIfExists, 194 fetchAvatarIfExists,
178 updateActorInstance, 195 updateActorInstance,
179 updateActorAvatarInstance 196 updateActorAvatarInstance,
197 addFetchOutboxJob
180} 198}
181 199
182// --------------------------------------------------------------------------- 200// ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/fetch.ts b/server/lib/activitypub/fetch.ts
deleted file mode 100644
index a8eefff80..000000000
--- a/server/lib/activitypub/fetch.ts
+++ /dev/null
@@ -1,23 +0,0 @@
1import { logger } from '../../helpers/logger'
2import { getServerActor } from '../../helpers/utils'
3import { ActorModel } from '../../models/activitypub/actor'
4import { JobQueue } from '../job-queue'
5
6async function addFetchOutboxJob (actor: ActorModel) {
7 // Don't fetch ourselves
8 const serverActor = await getServerActor()
9 if (serverActor.id === actor.id) {
10 logger.error('Cannot fetch our own outbox!')
11 return undefined
12 }
13
14 const payload = {
15 uris: [ actor.outboxUrl ]
16 }
17
18 return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })
19}
20
21export {
22 addFetchOutboxJob
23}
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts
index c55b57820..046370b79 100644
--- a/server/lib/activitypub/process/process-accept.ts
+++ b/server/lib/activitypub/process/process-accept.ts
@@ -2,7 +2,7 @@ import { ActivityAccept } from '../../../../shared/models/activitypub'
2import { getActorUrl } from '../../../helpers/activitypub' 2import { getActorUrl } from '../../../helpers/activitypub'
3import { ActorModel } from '../../../models/activitypub/actor' 3import { ActorModel } from '../../../models/activitypub/actor'
4import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 4import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
5import { addFetchOutboxJob } from '../fetch' 5import { addFetchOutboxJob } from '../actor'
6 6
7async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) { 7async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) {
8 if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.') 8 if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
diff --git a/server/lib/activitypub/send/misc.ts b/server/lib/activitypub/send/misc.ts
index b2d968c9c..646aa9f0a 100644
--- a/server/lib/activitypub/send/misc.ts
+++ b/server/lib/activitypub/send/misc.ts
@@ -139,9 +139,7 @@ async function getActorsInvolvedInVideo (video: VideoModel, t: Transaction) {
139} 139}
140 140
141async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) { 141async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {
142 const followerInboxUrls = await actorSender.getFollowerSharedInboxUrls(t) 142 return buildAudience([ actorSender.followersUrl ], isPublic)
143
144 return buildAudience(followerInboxUrls, isPublic)
145} 143}
146 144
147function buildAudience (followerInboxUrls: string[], isPublic = true) { 145function buildAudience (followerInboxUrls: string[], isPublic = true) {