1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Add outbox

This commit is contained in:
Chocobozzz 2017-11-21 18:23:10 +01:00
parent b1cbc0dd3e
commit e71bcc0f4b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
8 changed files with 170 additions and 28 deletions

View file

@ -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
}