diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-22 16:25:03 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:53 +0100 |
commit | 40ff57078e15d5b86ee6b71e198b95d3feb78eaf (patch) | |
tree | 88031d4eac6a26597e8a1f2fc63674664e3eae26 /server/controllers/activitypub | |
parent | c46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (diff) | |
download | PeerTube-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.ts | 14 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { Activity, ActivityAdd } from '../../../shared/models/activitypub/activity' | 2 | import { Activity, ActivityAdd } from '../../../shared/models/activitypub/activity' |
3 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' | 3 | import { activityPubCollectionPagination } from '../../helpers/activitypub' |
4 | import { pageToStartAndCount } from '../../helpers/core-utils' | ||
4 | import { database as db } from '../../initializers' | 5 | import { database as db } from '../../initializers' |
6 | import { ACTIVITY_PUB } from '../../initializers/constants' | ||
5 | import { addActivityData } from '../../lib/activitypub/send/send-add' | 7 | import { addActivityData } from '../../lib/activitypub/send/send-add' |
6 | import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url' | 8 | import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url' |
7 | import { announceActivityData } from '../../lib/index' | 9 | import { announceActivityData } from '../../lib/index' |
8 | import { asyncMiddleware, localAccountValidator } from '../../middlewares' | 10 | import { asyncMiddleware, localAccountValidator } from '../../middlewares' |
9 | import { AccountInstance } from '../../models/account/account-interface' | 11 | import { AccountInstance } from '../../models/account/account-interface' |
10 | import { pageToStartAndCount } from '../../helpers/core-utils' | ||
11 | import { ACTIVITY_PUB } from '../../initializers/constants' | ||
12 | 12 | ||
13 | const outboxRouter = express.Router() | 13 | const 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 | } |