diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-21 18:23:10 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:53 +0100 |
commit | e71bcc0f4b31ecfd84a786411febfc6d18a85258 (patch) | |
tree | ea31776b6bc69bd3b72e6c6f615cf94072271c82 /server/lib/activitypub | |
parent | b1cbc0dd3ee0fce6d8390b6d3996386a5b6097ac (diff) | |
download | PeerTube-e71bcc0f4b31ecfd84a786411febfc6d18a85258.tar.gz PeerTube-e71bcc0f4b31ecfd84a786411febfc6d18a85258.tar.zst PeerTube-e71bcc0f4b31ecfd84a786411febfc6d18a85258.zip |
Add outbox
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/send/send-announce.ts | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/server/lib/activitypub/send/send-announce.ts b/server/lib/activitypub/send/send-announce.ts index 4b3a4ef75..b8ea51bc0 100644 --- a/server/lib/activitypub/send/send-announce.ts +++ b/server/lib/activitypub/send/send-announce.ts | |||
@@ -1,10 +1,12 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { ActivityAdd } from '../../../../shared/index' | ||
3 | import { ActivityAnnounce, ActivityCreate } from '../../../../shared/models/activitypub/activity' | ||
2 | import { AccountInstance, VideoInstance } from '../../../models' | 4 | import { AccountInstance, VideoInstance } from '../../../models' |
3 | import { VideoChannelInstance } from '../../../models/video/video-channel-interface' | 5 | import { VideoChannelInstance } from '../../../models/video/video-channel-interface' |
6 | import { getAnnounceActivityPubUrl } from '../url' | ||
4 | import { broadcastToFollowers } from './misc' | 7 | import { broadcastToFollowers } from './misc' |
5 | import { addActivityData } from './send-add' | 8 | import { addActivityData } from './send-add' |
6 | import { createActivityData } from './send-create' | 9 | import { createActivityData } from './send-create' |
7 | import { getAnnounceActivityPubUrl } from '../url' | ||
8 | 10 | ||
9 | async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { | 11 | async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { |
10 | const url = getAnnounceActivityPubUrl(video.url, byAccount) | 12 | const url = getAnnounceActivityPubUrl(video.url, byAccount) |
@@ -24,17 +26,8 @@ async function sendVideoChannelAnnounce (byAccount: AccountInstance, videoChanne | |||
24 | return broadcastToFollowers(data, byAccount, [ byAccount ], t) | 26 | return broadcastToFollowers(data, byAccount, [ byAccount ], t) |
25 | } | 27 | } |
26 | 28 | ||
27 | // --------------------------------------------------------------------------- | 29 | async function announceActivityData (url: string, byAccount: AccountInstance, object: ActivityCreate | ActivityAdd) { |
28 | 30 | const activity: ActivityAnnounce = { | |
29 | export { | ||
30 | sendVideoAnnounce, | ||
31 | sendVideoChannelAnnounce | ||
32 | } | ||
33 | |||
34 | // --------------------------------------------------------------------------- | ||
35 | |||
36 | async function announceActivityData (url: string, byAccount: AccountInstance, object: any) { | ||
37 | const activity = { | ||
38 | type: 'Announce', | 31 | type: 'Announce', |
39 | id: url, | 32 | id: url, |
40 | actor: byAccount.url, | 33 | actor: byAccount.url, |
@@ -43,3 +36,11 @@ async function announceActivityData (url: string, byAccount: AccountInstance, ob | |||
43 | 36 | ||
44 | return activity | 37 | return activity |
45 | } | 38 | } |
39 | |||
40 | // --------------------------------------------------------------------------- | ||
41 | |||
42 | export { | ||
43 | sendVideoAnnounce, | ||
44 | sendVideoChannelAnnounce, | ||
45 | announceActivityData | ||
46 | } | ||