From e71bcc0f4b31ecfd84a786411febfc6d18a85258 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Nov 2017 18:23:10 +0100 Subject: Add outbox --- server/lib/activitypub/send/send-announce.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'server/lib/activitypub/send/send-announce.ts') 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 @@ import { Transaction } from 'sequelize' +import { ActivityAdd } from '../../../../shared/index' +import { ActivityAnnounce, ActivityCreate } from '../../../../shared/models/activitypub/activity' import { AccountInstance, VideoInstance } from '../../../models' import { VideoChannelInstance } from '../../../models/video/video-channel-interface' +import { getAnnounceActivityPubUrl } from '../url' import { broadcastToFollowers } from './misc' import { addActivityData } from './send-add' import { createActivityData } from './send-create' -import { getAnnounceActivityPubUrl } from '../url' async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Transaction) { const url = getAnnounceActivityPubUrl(video.url, byAccount) @@ -24,17 +26,8 @@ async function sendVideoChannelAnnounce (byAccount: AccountInstance, videoChanne return broadcastToFollowers(data, byAccount, [ byAccount ], t) } -// --------------------------------------------------------------------------- - -export { - sendVideoAnnounce, - sendVideoChannelAnnounce -} - -// --------------------------------------------------------------------------- - -async function announceActivityData (url: string, byAccount: AccountInstance, object: any) { - const activity = { +async function announceActivityData (url: string, byAccount: AccountInstance, object: ActivityCreate | ActivityAdd) { + const activity: ActivityAnnounce = { type: 'Announce', id: url, actor: byAccount.url, @@ -43,3 +36,11 @@ async function announceActivityData (url: string, byAccount: AccountInstance, ob return activity } + +// --------------------------------------------------------------------------- + +export { + sendVideoAnnounce, + sendVideoChannelAnnounce, + announceActivityData +} -- cgit v1.2.3