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 { unicastTo } from './utils'
|
||||
import { followActivityData } from './send-follow'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function sendAccept (actorFollow: ActorFollowModel) {
|
||||
const follower = actorFollow.ActorFollower
|
||||
const me = actorFollow.ActorFollowing
|
||||
|
||||
logger.info('Creating job to accept follower %s.', follower.url)
|
||||
|
||||
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
||||
const followData = followActivityData(followUrl, follower, me)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import { VideoModel } from '../../../models/video/video'
|
|||
import { VideoShareModel } from '../../../models/video/video-share'
|
||||
import { broadcastToFollowers } from './utils'
|
||||
import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
|
||||
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) {
|
||||
const data = await buildVideoAnnounce(byActor, videoShare, video, t)
|
||||
|
||||
logger.info('Creating job to send announce %s.', videoShare.url)
|
||||
|
||||
return broadcastToFollowers(data, byActor, [ byActor ], t)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,13 @@ import {
|
|||
getVideoAudience,
|
||||
getVideoCommentAudience
|
||||
} from '../audience'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function sendCreateVideo (video: VideoModel, t: Transaction) {
|
||||
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 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) {
|
||||
const url = getVideoAbuseActivityPubUrl(videoAbuse)
|
||||
|
||||
logger.info('Creating job to send video abuse %s.', url)
|
||||
|
||||
const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
|
||||
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) {
|
||||
logger.info('Creating job to send comment %s.', comment.url)
|
||||
|
||||
const isOrigin = comment.Video.isOwned()
|
||||
|
||||
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) {
|
||||
logger.info('Creating job to send view of %s.', video.url)
|
||||
|
||||
const url = getVideoViewActivityPubUrl(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) {
|
||||
logger.info('Creating job to dislike %s.', video.url)
|
||||
|
||||
const url = getVideoDislikeActivityPubUrl(byActor, video)
|
||||
const dislikeActivityData = createDislikeActivityData(byActor, video)
|
||||
|
||||
|
|
|
@ -7,8 +7,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
|
|||
import { getDeleteActivityPubUrl } from '../url'
|
||||
import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils'
|
||||
import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
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 byActor = video.VideoChannel.Account.Actor
|
||||
|
||||
|
@ -21,6 +24,8 @@ async function sendDeleteVideo (video: VideoModel, 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 data = deleteActivityData(url, byActor.url, byActor)
|
||||
|
||||
|
@ -31,6 +36,8 @@ async function sendDeleteActor (byActor: ActorModel, 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 url = getDeleteActivityPubUrl(videoComment.url)
|
||||
|
|
|
@ -3,11 +3,14 @@ import { ActorModel } from '../../../models/activitypub/actor'
|
|||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { getActorFollowActivityPubUrl } from '../url'
|
||||
import { unicastTo } from './utils'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
function sendFollow (actorFollow: ActorFollowModel) {
|
||||
const me = actorFollow.ActorFollower
|
||||
const following = actorFollow.ActorFollowing
|
||||
|
||||
logger.info('Creating job to send follow request to %s.', following.url)
|
||||
|
||||
const url = getActorFollowActivityPubUrl(actorFollow)
|
||||
const data = followActivityData(url, me, following)
|
||||
|
||||
|
|
|
@ -5,8 +5,11 @@ import { VideoModel } from '../../../models/video/video'
|
|||
import { getVideoLikeActivityPubUrl } from '../url'
|
||||
import { broadcastToFollowers, unicastTo } from './utils'
|
||||
import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) {
|
||||
logger.info('Creating job to like %s.', video.url)
|
||||
|
||||
const url = getVideoLikeActivityPubUrl(byActor, video)
|
||||
|
||||
const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
||||
|
|
|
@ -18,11 +18,14 @@ import { followActivityData } from './send-follow'
|
|||
import { likeActivityData } from './send-like'
|
||||
import { VideoShareModel } from '../../../models/video/video-share'
|
||||
import { buildVideoAnnounce } from './send-announce'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
|
||||
const me = actorFollow.ActorFollower
|
||||
const following = actorFollow.ActorFollowing
|
||||
|
||||
logger.info('Creating job to send an unfollow request to %s.', following.url)
|
||||
|
||||
const followUrl = getActorFollowActivityPubUrl(actorFollow)
|
||||
const undoUrl = getUndoActivityPubUrl(followUrl)
|
||||
|
||||
|
@ -33,6 +36,8 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, 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 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) {
|
||||
logger.info('Creating job to undo a dislike of video %s.', video.url)
|
||||
|
||||
const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video)
|
||||
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) {
|
||||
logger.info('Creating job to undo announce %s.', videoShare.url)
|
||||
|
||||
const undoUrl = getUndoActivityPubUrl(videoShare.url)
|
||||
|
||||
const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t)
|
||||
|
|
|
@ -9,8 +9,11 @@ import { VideoShareModel } from '../../../models/video/video-share'
|
|||
import { getUpdateActivityPubUrl } from '../url'
|
||||
import { broadcastToFollowers } from './utils'
|
||||
import { audiencify, getAudience } from '../audience'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
async function sendUpdateVideo (video: VideoModel, t: Transaction) {
|
||||
logger.info('Creating job to update video %s.', video.url)
|
||||
|
||||
const byActor = video.VideoChannel.Account.Actor
|
||||
|
||||
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) {
|
||||
const byActor = accountOrChannel.Actor
|
||||
|
||||
logger.info('Creating job to update actor %s.', byActor.url)
|
||||
|
||||
const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
|
||||
const accountOrChannelObject = accountOrChannel.toActivityPubObject()
|
||||
const audience = getAudience(byActor)
|
||||
|
|
|
@ -26,6 +26,8 @@ async function forwardActivity (
|
|||
followersException: ActorModel[] = [],
|
||||
additionalFollowerUrls: string[] = []
|
||||
) {
|
||||
logger.info('Forwarding activity %s.', activity.id)
|
||||
|
||||
const to = activity.to || []
|
||||
const cc = activity.cc || []
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@ export class AccountModel extends Model<AccountModel> {
|
|||
}
|
||||
|
||||
if (instance.isOwned()) {
|
||||
logger.debug('Sending delete of actor of account %s.', instance.Actor.url)
|
||||
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 { unlinkPromise } from '../../helpers/core-utils'
|
||||
import { CONFIG, STATIC_PATHS } from '../../initializers'
|
||||
import { logger } from '../../helpers/logger'
|
||||
|
||||
@Table({
|
||||
tableName: 'avatar'
|
||||
|
@ -21,6 +22,7 @@ export class AvatarModel extends Model<AvatarModel> {
|
|||
|
||||
@AfterDestroy
|
||||
static removeFilesAndSendDelete (instance: AvatarModel) {
|
||||
logger.info('Removing avatar file %s.', instance.filename)
|
||||
return instance.removeAvatar()
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
|
|||
}
|
||||
|
||||
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 {
|
||||
await instance.removeCaptionFile()
|
||||
|
|
|
@ -140,8 +140,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
|
|||
}
|
||||
|
||||
if (instance.Actor.isOwned()) {
|
||||
logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url)
|
||||
|
||||
return sendDeleteActor(instance.Actor, options.transaction)
|
||||
}
|
||||
|
||||
|
|
|
@ -607,8 +607,6 @@ export class VideoModel extends Model<VideoModel> {
|
|||
}) as VideoChannelModel
|
||||
}
|
||||
|
||||
logger.debug('Sending delete of video %s.', instance.url)
|
||||
|
||||
return sendDeleteVideo(instance, options.transaction)
|
||||
}
|
||||
|
||||
|
@ -619,7 +617,7 @@ export class VideoModel extends Model<VideoModel> {
|
|||
static async removeFiles (instance: VideoModel) {
|
||||
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())
|
||||
|
||||
|
|
Loading…
Reference in New Issue