aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-22 16:25:03 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit40ff57078e15d5b86ee6b71e198b95d3feb78eaf (patch)
tree88031d4eac6a26597e8a1f2fc63674664e3eae26 /server/controllers/activitypub
parentc46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (diff)
downloadPeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.gz
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.zst
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.zip
Federate video views
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/outbox.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts
index 74d399763..8c63eeb2e 100644
--- a/server/controllers/activitypub/outbox.ts
+++ b/server/controllers/activitypub/outbox.ts
@@ -1,14 +1,14 @@
1import * as express from 'express' 1import * as express from 'express'
2import { Activity, ActivityAdd } from '../../../shared/models/activitypub/activity' 2import { Activity, ActivityAdd } from '../../../shared/models/activitypub/activity'
3import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' 3import { activityPubCollectionPagination } from '../../helpers/activitypub'
4import { pageToStartAndCount } from '../../helpers/core-utils'
4import { database as db } from '../../initializers' 5import { database as db } from '../../initializers'
6import { ACTIVITY_PUB } from '../../initializers/constants'
5import { addActivityData } from '../../lib/activitypub/send/send-add' 7import { addActivityData } from '../../lib/activitypub/send/send-add'
6import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url' 8import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
7import { announceActivityData } from '../../lib/index' 9import { announceActivityData } from '../../lib/index'
8import { asyncMiddleware, localAccountValidator } from '../../middlewares' 10import { asyncMiddleware, localAccountValidator } from '../../middlewares'
9import { AccountInstance } from '../../models/account/account-interface' 11import { AccountInstance } from '../../models/account/account-interface'
10import { pageToStartAndCount } from '../../helpers/core-utils'
11import { ACTIVITY_PUB } from '../../initializers/constants'
12 12
13const outboxRouter = express.Router() 13const outboxRouter = express.Router()
14 14
@@ -36,14 +36,18 @@ async function outboxController (req: express.Request, res: express.Response, ne
36 36
37 for (const video of data.data) { 37 for (const video of data.data) {
38 const videoObject = video.toActivityPubObject() 38 const videoObject = video.toActivityPubObject()
39 let addActivity: ActivityAdd = await addActivityData(video.url, account, video, video.VideoChannel.url, videoObject)
40 39
41 // This is a shared video 40 // This is a shared video
42 if (video.VideoShare !== undefined) { 41 if (video.VideoShares !== undefined && video.VideoShares.length !== 0) {
42 const addActivity = await addActivityData(video.url, video.VideoChannel.Account, video, video.VideoChannel.url, videoObject)
43
43 const url = getAnnounceActivityPubUrl(video.url, account) 44 const url = getAnnounceActivityPubUrl(video.url, account)
44 const announceActivity = await announceActivityData(url, account, addActivity) 45 const announceActivity = await announceActivityData(url, account, addActivity)
46
45 activities.push(announceActivity) 47 activities.push(announceActivity)
46 } else { 48 } else {
49 const addActivity = await addActivityData(video.url, account, video, video.VideoChannel.url, videoObject)
50
47 activities.push(addActivity) 51 activities.push(addActivity)
48 } 52 }
49 } 53 }