aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-21 18:23:10 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commite71bcc0f4b31ecfd84a786411febfc6d18a85258 (patch)
treeea31776b6bc69bd3b72e6c6f615cf94072271c82 /server/lib/activitypub
parentb1cbc0dd3ee0fce6d8390b6d3996386a5b6097ac (diff)
downloadPeerTube-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.ts25
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 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { ActivityAdd } from '../../../../shared/index'
3import { ActivityAnnounce, ActivityCreate } from '../../../../shared/models/activitypub/activity'
2import { AccountInstance, VideoInstance } from '../../../models' 4import { AccountInstance, VideoInstance } from '../../../models'
3import { VideoChannelInstance } from '../../../models/video/video-channel-interface' 5import { VideoChannelInstance } from '../../../models/video/video-channel-interface'
6import { getAnnounceActivityPubUrl } from '../url'
4import { broadcastToFollowers } from './misc' 7import { broadcastToFollowers } from './misc'
5import { addActivityData } from './send-add' 8import { addActivityData } from './send-add'
6import { createActivityData } from './send-create' 9import { createActivityData } from './send-create'
7import { getAnnounceActivityPubUrl } from '../url'
8 10
9async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { 11async 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// --------------------------------------------------------------------------- 29async function announceActivityData (url: string, byAccount: AccountInstance, object: ActivityCreate | ActivityAdd) {
28 30 const activity: ActivityAnnounce = {
29export {
30 sendVideoAnnounce,
31 sendVideoChannelAnnounce
32}
33
34// ---------------------------------------------------------------------------
35
36async 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
42export {
43 sendVideoAnnounce,
44 sendVideoChannelAnnounce,
45 announceActivityData
46}