diff options
Diffstat (limited to 'server/lib/activitypub/send/misc.ts')
-rw-r--r-- | server/lib/activitypub/send/misc.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/server/lib/activitypub/send/misc.ts b/server/lib/activitypub/send/misc.ts index f3dc5c148..41a039b19 100644 --- a/server/lib/activitypub/send/misc.ts +++ b/server/lib/activitypub/send/misc.ts | |||
@@ -3,6 +3,7 @@ import { logger } from '../../../helpers/logger' | |||
3 | import { ACTIVITY_PUB, database as db } from '../../../initializers' | 3 | import { ACTIVITY_PUB, database as db } from '../../../initializers' |
4 | import { AccountInstance } from '../../../models/account/account-interface' | 4 | import { AccountInstance } from '../../../models/account/account-interface' |
5 | import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' | 5 | import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' |
6 | import { VideoInstance } from '../../../models/video/video-interface' | ||
6 | 7 | ||
7 | async function broadcastToFollowers ( | 8 | async function broadcastToFollowers ( |
8 | data: any, | 9 | data: any, |
@@ -41,6 +42,27 @@ async function unicastTo (data: any, byAccount: AccountInstance, toAccountUrl: s | |||
41 | return activitypubHttpJobScheduler.createJob(t, 'activitypubHttpUnicastHandler', jobPayload) | 42 | return activitypubHttpJobScheduler.createJob(t, 'activitypubHttpUnicastHandler', jobPayload) |
42 | } | 43 | } |
43 | 44 | ||
45 | function getOriginVideoAudience (video: VideoInstance) { | ||
46 | return { | ||
47 | to: [ video.VideoChannel.Account.url ], | ||
48 | cc: [ video.VideoChannel.Account.url + '/followers' ] | ||
49 | } | ||
50 | } | ||
51 | |||
52 | function getVideoFollowersAudience (video: VideoInstance) { | ||
53 | return { | ||
54 | to: [ video.VideoChannel.Account.url + '/followers' ], | ||
55 | cc: [] | ||
56 | } | ||
57 | } | ||
58 | |||
59 | async function getAccountsToForwardVideoAction (byAccount: AccountInstance, video: VideoInstance) { | ||
60 | const accountsToForwardView = await db.VideoShare.loadAccountsByShare(video.id) | ||
61 | accountsToForwardView.push(video.VideoChannel.Account) | ||
62 | |||
63 | return accountsToForwardView | ||
64 | } | ||
65 | |||
44 | async function getAudience (accountSender: AccountInstance, isPublic = true) { | 66 | async function getAudience (accountSender: AccountInstance, isPublic = true) { |
45 | const followerInboxUrls = await accountSender.getFollowerSharedInboxUrls() | 67 | const followerInboxUrls = await accountSender.getFollowerSharedInboxUrls() |
46 | 68 | ||
@@ -64,5 +86,8 @@ async function getAudience (accountSender: AccountInstance, isPublic = true) { | |||
64 | export { | 86 | export { |
65 | broadcastToFollowers, | 87 | broadcastToFollowers, |
66 | unicastTo, | 88 | unicastTo, |
67 | getAudience | 89 | getAudience, |
90 | getOriginVideoAudience, | ||
91 | getAccountsToForwardVideoAction, | ||
92 | getVideoFollowersAudience | ||
68 | } | 93 | } |