Add more info logging
This commit is contained in:
parent
43c4c63937
commit
8e0fd45e14
|
@ -4,11 +4,14 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||||
import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url'
|
import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url'
|
||||||
import { unicastTo } from './utils'
|
import { unicastTo } from './utils'
|
||||||
import { followActivityData } from './send-follow'
|
import { followActivityData } from './send-follow'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendAccept (actorFollow: ActorFollowModel) {
|
async function sendAccept (actorFollow: ActorFollowModel) {
|
||||||
const follower = actorFollow.ActorFollower
|
const follower = actorFollow.ActorFollower
|
||||||
const me = actorFollow.ActorFollowing
|
const me = actorFollow.ActorFollowing
|
||||||
|
|
||||||
|
logger.info('Creating job to accept follower %s.', follower.url)
|
||||||
|
|
||||||
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
||||||
const followData = followActivityData(followUrl, follower, me)
|
const followData = followActivityData(followUrl, follower, me)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { VideoModel } from '../../../models/video/video'
|
||||||
import { VideoShareModel } from '../../../models/video/video-share'
|
import { VideoShareModel } from '../../../models/video/video-share'
|
||||||
import { broadcastToFollowers } from './utils'
|
import { broadcastToFollowers } from './utils'
|
||||||
import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience'
|
import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
||||||
const announcedObject = video.url
|
const announcedObject = video.url
|
||||||
|
@ -17,6 +18,8 @@ async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareMo
|
||||||
async function sendVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
async function sendVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
||||||
const data = await buildVideoAnnounce(byActor, videoShare, video, t)
|
const data = await buildVideoAnnounce(byActor, videoShare, video, t)
|
||||||
|
|
||||||
|
logger.info('Creating job to send announce %s.', videoShare.url)
|
||||||
|
|
||||||
return broadcastToFollowers(data, byActor, [ byActor ], t)
|
return broadcastToFollowers(data, byActor, [ byActor ], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,13 @@ import {
|
||||||
getVideoAudience,
|
getVideoAudience,
|
||||||
getVideoCommentAudience
|
getVideoCommentAudience
|
||||||
} from '../audience'
|
} from '../audience'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendCreateVideo (video: VideoModel, t: Transaction) {
|
async function sendCreateVideo (video: VideoModel, t: Transaction) {
|
||||||
if (video.privacy === VideoPrivacy.PRIVATE) return undefined
|
if (video.privacy === VideoPrivacy.PRIVATE) return undefined
|
||||||
|
|
||||||
|
logger.info('Creating job to send video creation of %s.', video.url)
|
||||||
|
|
||||||
const byActor = video.VideoChannel.Account.Actor
|
const byActor = video.VideoChannel.Account.Actor
|
||||||
const videoObject = video.toActivityPubObject()
|
const videoObject = video.toActivityPubObject()
|
||||||
|
|
||||||
|
@ -32,6 +35,8 @@ async function sendCreateVideo (video: VideoModel, t: Transaction) {
|
||||||
async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) {
|
async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) {
|
||||||
const url = getVideoAbuseActivityPubUrl(videoAbuse)
|
const url = getVideoAbuseActivityPubUrl(videoAbuse)
|
||||||
|
|
||||||
|
logger.info('Creating job to send video abuse %s.', url)
|
||||||
|
|
||||||
const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
|
const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
|
||||||
const data = createActivityData(url, byActor, videoAbuse.toActivityPubObject(), audience)
|
const data = createActivityData(url, byActor, videoAbuse.toActivityPubObject(), audience)
|
||||||
|
|
||||||
|
@ -39,6 +44,8 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel,
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendCreateVideoComment (comment: VideoCommentModel, t: Transaction) {
|
async function sendCreateVideoComment (comment: VideoCommentModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to send comment %s.', comment.url)
|
||||||
|
|
||||||
const isOrigin = comment.Video.isOwned()
|
const isOrigin = comment.Video.isOwned()
|
||||||
|
|
||||||
const byActor = comment.Account.Actor
|
const byActor = comment.Account.Actor
|
||||||
|
@ -74,6 +81,8 @@ async function sendCreateVideoComment (comment: VideoCommentModel, t: Transactio
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to send view of %s.', video.url)
|
||||||
|
|
||||||
const url = getVideoViewActivityPubUrl(byActor, video)
|
const url = getVideoViewActivityPubUrl(byActor, video)
|
||||||
const viewActivityData = createViewActivityData(byActor, video)
|
const viewActivityData = createViewActivityData(byActor, video)
|
||||||
|
|
||||||
|
@ -98,6 +107,8 @@ async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transa
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to dislike %s.', video.url)
|
||||||
|
|
||||||
const url = getVideoDislikeActivityPubUrl(byActor, video)
|
const url = getVideoDislikeActivityPubUrl(byActor, video)
|
||||||
const dislikeActivityData = createDislikeActivityData(byActor, video)
|
const dislikeActivityData = createDislikeActivityData(byActor, video)
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
|
||||||
import { getDeleteActivityPubUrl } from '../url'
|
import { getDeleteActivityPubUrl } from '../url'
|
||||||
import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils'
|
import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils'
|
||||||
import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
|
import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendDeleteVideo (video: VideoModel, t: Transaction) {
|
async function sendDeleteVideo (video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to broadcast delete of video %s.', video.url)
|
||||||
|
|
||||||
const url = getDeleteActivityPubUrl(video.url)
|
const url = getDeleteActivityPubUrl(video.url)
|
||||||
const byActor = video.VideoChannel.Account.Actor
|
const byActor = video.VideoChannel.Account.Actor
|
||||||
|
|
||||||
|
@ -21,6 +24,8 @@ async function sendDeleteVideo (video: VideoModel, t: Transaction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
|
async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to broadcast delete of actor %s.', byActor.url)
|
||||||
|
|
||||||
const url = getDeleteActivityPubUrl(byActor.url)
|
const url = getDeleteActivityPubUrl(byActor.url)
|
||||||
const data = deleteActivityData(url, byActor.url, byActor)
|
const data = deleteActivityData(url, byActor.url, byActor)
|
||||||
|
|
||||||
|
@ -31,6 +36,8 @@ async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) {
|
async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to send delete of comment %s.', videoComment.url)
|
||||||
|
|
||||||
const isVideoOrigin = videoComment.Video.isOwned()
|
const isVideoOrigin = videoComment.Video.isOwned()
|
||||||
|
|
||||||
const url = getDeleteActivityPubUrl(videoComment.url)
|
const url = getDeleteActivityPubUrl(videoComment.url)
|
||||||
|
|
|
@ -3,11 +3,14 @@ import { ActorModel } from '../../../models/activitypub/actor'
|
||||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||||
import { getActorFollowActivityPubUrl } from '../url'
|
import { getActorFollowActivityPubUrl } from '../url'
|
||||||
import { unicastTo } from './utils'
|
import { unicastTo } from './utils'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
function sendFollow (actorFollow: ActorFollowModel) {
|
function sendFollow (actorFollow: ActorFollowModel) {
|
||||||
const me = actorFollow.ActorFollower
|
const me = actorFollow.ActorFollower
|
||||||
const following = actorFollow.ActorFollowing
|
const following = actorFollow.ActorFollowing
|
||||||
|
|
||||||
|
logger.info('Creating job to send follow request to %s.', following.url)
|
||||||
|
|
||||||
const url = getActorFollowActivityPubUrl(actorFollow)
|
const url = getActorFollowActivityPubUrl(actorFollow)
|
||||||
const data = followActivityData(url, me, following)
|
const data = followActivityData(url, me, following)
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,11 @@ import { VideoModel } from '../../../models/video/video'
|
||||||
import { getVideoLikeActivityPubUrl } from '../url'
|
import { getVideoLikeActivityPubUrl } from '../url'
|
||||||
import { broadcastToFollowers, unicastTo } from './utils'
|
import { broadcastToFollowers, unicastTo } from './utils'
|
||||||
import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience'
|
import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to like %s.', video.url)
|
||||||
|
|
||||||
const url = getVideoLikeActivityPubUrl(byActor, video)
|
const url = getVideoLikeActivityPubUrl(byActor, video)
|
||||||
|
|
||||||
const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
||||||
|
|
|
@ -18,11 +18,14 @@ import { followActivityData } from './send-follow'
|
||||||
import { likeActivityData } from './send-like'
|
import { likeActivityData } from './send-like'
|
||||||
import { VideoShareModel } from '../../../models/video/video-share'
|
import { VideoShareModel } from '../../../models/video/video-share'
|
||||||
import { buildVideoAnnounce } from './send-announce'
|
import { buildVideoAnnounce } from './send-announce'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
|
async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
|
||||||
const me = actorFollow.ActorFollower
|
const me = actorFollow.ActorFollower
|
||||||
const following = actorFollow.ActorFollowing
|
const following = actorFollow.ActorFollowing
|
||||||
|
|
||||||
|
logger.info('Creating job to send an unfollow request to %s.', following.url)
|
||||||
|
|
||||||
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
||||||
const undoUrl = getUndoActivityPubUrl(followUrl)
|
const undoUrl = getUndoActivityPubUrl(followUrl)
|
||||||
|
|
||||||
|
@ -33,6 +36,8 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to undo a like of video %s.', video.url)
|
||||||
|
|
||||||
const likeUrl = getVideoLikeActivityPubUrl(byActor, video)
|
const likeUrl = getVideoLikeActivityPubUrl(byActor, video)
|
||||||
const undoUrl = getUndoActivityPubUrl(likeUrl)
|
const undoUrl = getUndoActivityPubUrl(likeUrl)
|
||||||
|
|
||||||
|
@ -55,6 +60,8 @@ async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transact
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to undo a dislike of video %s.', video.url)
|
||||||
|
|
||||||
const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video)
|
const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video)
|
||||||
const undoUrl = getUndoActivityPubUrl(dislikeUrl)
|
const undoUrl = getUndoActivityPubUrl(dislikeUrl)
|
||||||
|
|
||||||
|
@ -76,6 +83,8 @@ async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Trans
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to undo announce %s.', videoShare.url)
|
||||||
|
|
||||||
const undoUrl = getUndoActivityPubUrl(videoShare.url)
|
const undoUrl = getUndoActivityPubUrl(videoShare.url)
|
||||||
|
|
||||||
const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
||||||
|
|
|
@ -9,8 +9,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
|
||||||
import { getUpdateActivityPubUrl } from '../url'
|
import { getUpdateActivityPubUrl } from '../url'
|
||||||
import { broadcastToFollowers } from './utils'
|
import { broadcastToFollowers } from './utils'
|
||||||
import { audiencify, getAudience } from '../audience'
|
import { audiencify, getAudience } from '../audience'
|
||||||
|
import { logger } from '../../../helpers/logger'
|
||||||
|
|
||||||
async function sendUpdateVideo (video: VideoModel, t: Transaction) {
|
async function sendUpdateVideo (video: VideoModel, t: Transaction) {
|
||||||
|
logger.info('Creating job to update video %s.', video.url)
|
||||||
|
|
||||||
const byActor = video.VideoChannel.Account.Actor
|
const byActor = video.VideoChannel.Account.Actor
|
||||||
|
|
||||||
const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())
|
const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())
|
||||||
|
@ -28,6 +31,8 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction) {
|
||||||
async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelModel, t: Transaction) {
|
async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelModel, t: Transaction) {
|
||||||
const byActor = accountOrChannel.Actor
|
const byActor = accountOrChannel.Actor
|
||||||
|
|
||||||
|
logger.info('Creating job to update actor %s.', byActor.url)
|
||||||
|
|
||||||
const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
|
const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
|
||||||
const accountOrChannelObject = accountOrChannel.toActivityPubObject()
|
const accountOrChannelObject = accountOrChannel.toActivityPubObject()
|
||||||
const audience = getAudience(byActor)
|
const audience = getAudience(byActor)
|
||||||
|
|
|
@ -26,6 +26,8 @@ async function forwardActivity (
|
||||||
followersException: ActorModel[] = [],
|
followersException: ActorModel[] = [],
|
||||||
additionalFollowerUrls: string[] = []
|
additionalFollowerUrls: string[] = []
|
||||||
) {
|
) {
|
||||||
|
logger.info('Forwarding activity %s.', activity.id)
|
||||||
|
|
||||||
const to = activity.to || []
|
const to = activity.to || []
|
||||||
const cc = activity.cc || []
|
const cc = activity.cc || []
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,6 @@ export class AccountModel extends Model<AccountModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance.isOwned()) {
|
if (instance.isOwned()) {
|
||||||
logger.debug('Sending delete of actor of account %s.', instance.Actor.url)
|
|
||||||
return sendDeleteActor(instance.Actor, options.transaction)
|
return sendDeleteActor(instance.Actor, options.transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { AfterDestroy, AllowNull, Column, CreatedAt, Model, Table, UpdatedAt } f
|
||||||
import { Avatar } from '../../../shared/models/avatars/avatar.model'
|
import { Avatar } from '../../../shared/models/avatars/avatar.model'
|
||||||
import { unlinkPromise } from '../../helpers/core-utils'
|
import { unlinkPromise } from '../../helpers/core-utils'
|
||||||
import { CONFIG, STATIC_PATHS } from '../../initializers'
|
import { CONFIG, STATIC_PATHS } from '../../initializers'
|
||||||
|
import { logger } from '../../helpers/logger'
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
tableName: 'avatar'
|
tableName: 'avatar'
|
||||||
|
@ -21,6 +22,7 @@ export class AvatarModel extends Model<AvatarModel> {
|
||||||
|
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
static removeFilesAndSendDelete (instance: AvatarModel) {
|
static removeFilesAndSendDelete (instance: AvatarModel) {
|
||||||
|
logger.info('Removing avatar file %s.', instance.filename)
|
||||||
return instance.removeAvatar()
|
return instance.removeAvatar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance.isOwned()) {
|
if (instance.isOwned()) {
|
||||||
logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language)
|
logger.info('Removing captions %s of video %s.', instance.Video.uuid, instance.language)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await instance.removeCaptionFile()
|
await instance.removeCaptionFile()
|
||||||
|
|
|
@ -140,8 +140,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance.Actor.isOwned()) {
|
if (instance.Actor.isOwned()) {
|
||||||
logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url)
|
|
||||||
|
|
||||||
return sendDeleteActor(instance.Actor, options.transaction)
|
return sendDeleteActor(instance.Actor, options.transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,8 +607,6 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
}) as VideoChannelModel
|
}) as VideoChannelModel
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug('Sending delete of video %s.', instance.url)
|
|
||||||
|
|
||||||
return sendDeleteVideo(instance, options.transaction)
|
return sendDeleteVideo(instance, options.transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +617,7 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
static async removeFiles (instance: VideoModel) {
|
static async removeFiles (instance: VideoModel) {
|
||||||
const tasks: Promise<any>[] = []
|
const tasks: Promise<any>[] = []
|
||||||
|
|
||||||
logger.debug('Removing files of video %s.', instance.url)
|
logger.info('Removing files of video %s.', instance.url)
|
||||||
|
|
||||||
tasks.push(instance.removeThumbnail())
|
tasks.push(instance.removeThumbnail())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue