diff options
Diffstat (limited to 'server/lib/activitypub/send')
-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 | } | ||