aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/send/send-accept.ts3
-rw-r--r--server/lib/activitypub/send/send-announce.ts3
-rw-r--r--server/lib/activitypub/send/send-create.ts11
-rw-r--r--server/lib/activitypub/send/send-delete.ts7
-rw-r--r--server/lib/activitypub/send/send-follow.ts3
-rw-r--r--server/lib/activitypub/send/send-like.ts3
-rw-r--r--server/lib/activitypub/send/send-undo.ts9
-rw-r--r--server/lib/activitypub/send/send-update.ts5
-rw-r--r--server/lib/activitypub/send/utils.ts2
9 files changed, 46 insertions, 0 deletions
diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.ts
index 44644a22f..dfee1ec3e 100644
--- a/server/lib/activitypub/send/send-accept.ts
+++ b/server/lib/activitypub/send/send-accept.ts
@@ -4,11 +4,14 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
4import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url' 4import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url'
5import { unicastTo } from './utils' 5import { unicastTo } from './utils'
6import { followActivityData } from './send-follow' 6import { followActivityData } from './send-follow'
7import { logger } from '../../../helpers/logger'
7 8
8async function sendAccept (actorFollow: ActorFollowModel) { 9async function sendAccept (actorFollow: ActorFollowModel) {
9 const follower = actorFollow.ActorFollower 10 const follower = actorFollow.ActorFollower
10 const me = actorFollow.ActorFollowing 11 const me = actorFollow.ActorFollowing
11 12
13 logger.info('Creating job to accept follower %s.', follower.url)
14
12 const followUrl = getActorFollowActivityPubUrl(actorFollow) 15 const followUrl = getActorFollowActivityPubUrl(actorFollow)
13 const followData = followActivityData(followUrl, follower, me) 16 const followData = followActivityData(followUrl, follower, me)
14 17
diff --git a/server/lib/activitypub/send/send-announce.ts b/server/lib/activitypub/send/send-announce.ts
index dfc099ff2..1ab05ca3c 100644
--- a/server/lib/activitypub/send/send-announce.ts
+++ b/server/lib/activitypub/send/send-announce.ts
@@ -5,6 +5,7 @@ import { VideoModel } from '../../../models/video/video'
5import { VideoShareModel } from '../../../models/video/video-share' 5import { VideoShareModel } from '../../../models/video/video-share'
6import { broadcastToFollowers } from './utils' 6import { broadcastToFollowers } from './utils'
7import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience' 7import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience'
8import { logger } from '../../../helpers/logger'
8 9
9async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { 10async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
10 const announcedObject = video.url 11 const announcedObject = video.url
@@ -17,6 +18,8 @@ async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareMo
17async function sendVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { 18async function sendVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
18 const data = await buildVideoAnnounce(byActor, videoShare, video, t) 19 const data = await buildVideoAnnounce(byActor, videoShare, video, t)
19 20
21 logger.info('Creating job to send announce %s.', videoShare.url)
22
20 return broadcastToFollowers(data, byActor, [ byActor ], t) 23 return broadcastToFollowers(data, byActor, [ byActor ], t)
21} 24}
22 25
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index 293947b05..f7a8cf0b3 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -16,10 +16,13 @@ import {
16 getVideoAudience, 16 getVideoAudience,
17 getVideoCommentAudience 17 getVideoCommentAudience
18} from '../audience' 18} from '../audience'
19import { logger } from '../../../helpers/logger'
19 20
20async function sendCreateVideo (video: VideoModel, t: Transaction) { 21async function sendCreateVideo (video: VideoModel, t: Transaction) {
21 if (video.privacy === VideoPrivacy.PRIVATE) return undefined 22 if (video.privacy === VideoPrivacy.PRIVATE) return undefined
22 23
24 logger.info('Creating job to send video creation of %s.', video.url)
25
23 const byActor = video.VideoChannel.Account.Actor 26 const byActor = video.VideoChannel.Account.Actor
24 const videoObject = video.toActivityPubObject() 27 const videoObject = video.toActivityPubObject()
25 28
@@ -32,6 +35,8 @@ async function sendCreateVideo (video: VideoModel, t: Transaction) {
32async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) { 35async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) {
33 const url = getVideoAbuseActivityPubUrl(videoAbuse) 36 const url = getVideoAbuseActivityPubUrl(videoAbuse)
34 37
38 logger.info('Creating job to send video abuse %s.', url)
39
35 const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } 40 const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
36 const data = createActivityData(url, byActor, videoAbuse.toActivityPubObject(), audience) 41 const data = createActivityData(url, byActor, videoAbuse.toActivityPubObject(), audience)
37 42
@@ -39,6 +44,8 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel,
39} 44}
40 45
41async function sendCreateVideoComment (comment: VideoCommentModel, t: Transaction) { 46async function sendCreateVideoComment (comment: VideoCommentModel, t: Transaction) {
47 logger.info('Creating job to send comment %s.', comment.url)
48
42 const isOrigin = comment.Video.isOwned() 49 const isOrigin = comment.Video.isOwned()
43 50
44 const byActor = comment.Account.Actor 51 const byActor = comment.Account.Actor
@@ -74,6 +81,8 @@ async function sendCreateVideoComment (comment: VideoCommentModel, t: Transactio
74} 81}
75 82
76async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transaction) { 83async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transaction) {
84 logger.info('Creating job to send view of %s.', video.url)
85
77 const url = getVideoViewActivityPubUrl(byActor, video) 86 const url = getVideoViewActivityPubUrl(byActor, video)
78 const viewActivityData = createViewActivityData(byActor, video) 87 const viewActivityData = createViewActivityData(byActor, video)
79 88
@@ -98,6 +107,8 @@ async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transa
98} 107}
99 108
100async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Transaction) { 109async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
110 logger.info('Creating job to dislike %s.', video.url)
111
101 const url = getVideoDislikeActivityPubUrl(byActor, video) 112 const url = getVideoDislikeActivityPubUrl(byActor, video)
102 const dislikeActivityData = createDislikeActivityData(byActor, video) 113 const dislikeActivityData = createDislikeActivityData(byActor, video)
103 114
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index e9a8951b5..3d1dfb699 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -7,8 +7,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
7import { getDeleteActivityPubUrl } from '../url' 7import { getDeleteActivityPubUrl } from '../url'
8import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils' 8import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils'
9import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience' 9import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
10import { logger } from '../../../helpers/logger'
10 11
11async function sendDeleteVideo (video: VideoModel, t: Transaction) { 12async function sendDeleteVideo (video: VideoModel, t: Transaction) {
13 logger.info('Creating job to broadcast delete of video %s.', video.url)
14
12 const url = getDeleteActivityPubUrl(video.url) 15 const url = getDeleteActivityPubUrl(video.url)
13 const byActor = video.VideoChannel.Account.Actor 16 const byActor = video.VideoChannel.Account.Actor
14 17
@@ -21,6 +24,8 @@ async function sendDeleteVideo (video: VideoModel, t: Transaction) {
21} 24}
22 25
23async function sendDeleteActor (byActor: ActorModel, t: Transaction) { 26async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
27 logger.info('Creating job to broadcast delete of actor %s.', byActor.url)
28
24 const url = getDeleteActivityPubUrl(byActor.url) 29 const url = getDeleteActivityPubUrl(byActor.url)
25 const data = deleteActivityData(url, byActor.url, byActor) 30 const data = deleteActivityData(url, byActor.url, byActor)
26 31
@@ -31,6 +36,8 @@ async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
31} 36}
32 37
33async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) { 38async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) {
39 logger.info('Creating job to send delete of comment %s.', videoComment.url)
40
34 const isVideoOrigin = videoComment.Video.isOwned() 41 const isVideoOrigin = videoComment.Video.isOwned()
35 42
36 const url = getDeleteActivityPubUrl(videoComment.url) 43 const url = getDeleteActivityPubUrl(videoComment.url)
diff --git a/server/lib/activitypub/send/send-follow.ts b/server/lib/activitypub/send/send-follow.ts
index f81d9a194..2faffe6e7 100644
--- a/server/lib/activitypub/send/send-follow.ts
+++ b/server/lib/activitypub/send/send-follow.ts
@@ -3,11 +3,14 @@ import { ActorModel } from '../../../models/activitypub/actor'
3import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 3import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
4import { getActorFollowActivityPubUrl } from '../url' 4import { getActorFollowActivityPubUrl } from '../url'
5import { unicastTo } from './utils' 5import { unicastTo } from './utils'
6import { logger } from '../../../helpers/logger'
6 7
7function sendFollow (actorFollow: ActorFollowModel) { 8function sendFollow (actorFollow: ActorFollowModel) {
8 const me = actorFollow.ActorFollower 9 const me = actorFollow.ActorFollower
9 const following = actorFollow.ActorFollowing 10 const following = actorFollow.ActorFollowing
10 11
12 logger.info('Creating job to send follow request to %s.', following.url)
13
11 const url = getActorFollowActivityPubUrl(actorFollow) 14 const url = getActorFollowActivityPubUrl(actorFollow)
12 const data = followActivityData(url, me, following) 15 const data = followActivityData(url, me, following)
13 16
diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.ts
index 37ee7c096..83225f5df 100644
--- a/server/lib/activitypub/send/send-like.ts
+++ b/server/lib/activitypub/send/send-like.ts
@@ -5,8 +5,11 @@ import { VideoModel } from '../../../models/video/video'
5import { getVideoLikeActivityPubUrl } from '../url' 5import { getVideoLikeActivityPubUrl } from '../url'
6import { broadcastToFollowers, unicastTo } from './utils' 6import { broadcastToFollowers, unicastTo } from './utils'
7import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience' 7import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience'
8import { logger } from '../../../helpers/logger'
8 9
9async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) { 10async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
11 logger.info('Creating job to like %s.', video.url)
12
10 const url = getVideoLikeActivityPubUrl(byActor, video) 13 const url = getVideoLikeActivityPubUrl(byActor, video)
11 14
12 const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) 15 const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts
index 33c3d2429..4e5dd3973 100644
--- a/server/lib/activitypub/send/send-undo.ts
+++ b/server/lib/activitypub/send/send-undo.ts
@@ -18,11 +18,14 @@ import { followActivityData } from './send-follow'
18import { likeActivityData } from './send-like' 18import { likeActivityData } from './send-like'
19import { VideoShareModel } from '../../../models/video/video-share' 19import { VideoShareModel } from '../../../models/video/video-share'
20import { buildVideoAnnounce } from './send-announce' 20import { buildVideoAnnounce } from './send-announce'
21import { logger } from '../../../helpers/logger'
21 22
22async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) { 23async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
23 const me = actorFollow.ActorFollower 24 const me = actorFollow.ActorFollower
24 const following = actorFollow.ActorFollowing 25 const following = actorFollow.ActorFollowing
25 26
27 logger.info('Creating job to send an unfollow request to %s.', following.url)
28
26 const followUrl = getActorFollowActivityPubUrl(actorFollow) 29 const followUrl = getActorFollowActivityPubUrl(actorFollow)
27 const undoUrl = getUndoActivityPubUrl(followUrl) 30 const undoUrl = getUndoActivityPubUrl(followUrl)
28 31
@@ -33,6 +36,8 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
33} 36}
34 37
35async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transaction) { 38async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
39 logger.info('Creating job to undo a like of video %s.', video.url)
40
36 const likeUrl = getVideoLikeActivityPubUrl(byActor, video) 41 const likeUrl = getVideoLikeActivityPubUrl(byActor, video)
37 const undoUrl = getUndoActivityPubUrl(likeUrl) 42 const undoUrl = getUndoActivityPubUrl(likeUrl)
38 43
@@ -55,6 +60,8 @@ async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transact
55} 60}
56 61
57async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Transaction) { 62async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
63 logger.info('Creating job to undo a dislike of video %s.', video.url)
64
58 const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video) 65 const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video)
59 const undoUrl = getUndoActivityPubUrl(dislikeUrl) 66 const undoUrl = getUndoActivityPubUrl(dislikeUrl)
60 67
@@ -76,6 +83,8 @@ async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Trans
76} 83}
77 84
78async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { 85async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
86 logger.info('Creating job to undo announce %s.', videoShare.url)
87
79 const undoUrl = getUndoActivityPubUrl(videoShare.url) 88 const undoUrl = getUndoActivityPubUrl(videoShare.url)
80 89
81 const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) 90 const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index 2fd374ec6..17d4f185c 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -9,8 +9,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
9import { getUpdateActivityPubUrl } from '../url' 9import { getUpdateActivityPubUrl } from '../url'
10import { broadcastToFollowers } from './utils' 10import { broadcastToFollowers } from './utils'
11import { audiencify, getAudience } from '../audience' 11import { audiencify, getAudience } from '../audience'
12import { logger } from '../../../helpers/logger'
12 13
13async function sendUpdateVideo (video: VideoModel, t: Transaction) { 14async function sendUpdateVideo (video: VideoModel, t: Transaction) {
15 logger.info('Creating job to update video %s.', video.url)
16
14 const byActor = video.VideoChannel.Account.Actor 17 const byActor = video.VideoChannel.Account.Actor
15 18
16 const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) 19 const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())
@@ -28,6 +31,8 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction) {
28async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelModel, t: Transaction) { 31async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelModel, t: Transaction) {
29 const byActor = accountOrChannel.Actor 32 const byActor = accountOrChannel.Actor
30 33
34 logger.info('Creating job to update actor %s.', byActor.url)
35
31 const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString()) 36 const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
32 const accountOrChannelObject = accountOrChannel.toActivityPubObject() 37 const accountOrChannelObject = accountOrChannel.toActivityPubObject()
33 const audience = getAudience(byActor) 38 const audience = getAudience(byActor)
diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts
index 241db6c8c..0d28444ec 100644
--- a/server/lib/activitypub/send/utils.ts
+++ b/server/lib/activitypub/send/utils.ts
@@ -26,6 +26,8 @@ async function forwardActivity (
26 followersException: ActorModel[] = [], 26 followersException: ActorModel[] = [],
27 additionalFollowerUrls: string[] = [] 27 additionalFollowerUrls: string[] = []
28) { 28) {
29 logger.info('Forwarding activity %s.', activity.id)
30
29 const to = activity.to || [] 31 const to = activity.to || []
30 const cc = activity.cc || [] 32 const cc = activity.cc || []
31 33