mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Add tags to logs in AP videos
This commit is contained in:
parent
e872632091
commit
463206948d
7 changed files with 46 additions and 25 deletions
|
@ -1,16 +1,19 @@
|
|||
import { checkUrlsSameHost } from '@server/helpers/activitypub'
|
||||
import { sanitizeAndCheckVideoTorrentObject } from '@server/helpers/custom-validators/activitypub/videos'
|
||||
import { logger } from '@server/helpers/logger'
|
||||
import { logger, loggerTagsFactory } from '@server/helpers/logger'
|
||||
import { doJSONRequest } from '@server/helpers/requests'
|
||||
import { VideoObject } from '@shared/models'
|
||||
|
||||
const lTags = loggerTagsFactory('ap', 'video')
|
||||
|
||||
async function fetchRemoteVideo (videoUrl: string): Promise<{ statusCode: number, videoObject: VideoObject }> {
|
||||
logger.info('Fetching remote video %s.', videoUrl)
|
||||
logger.info('Fetching remote video %s.', videoUrl, lTags(videoUrl))
|
||||
|
||||
const { statusCode, body } = await doJSONRequest<any>(videoUrl, { activityPub: true })
|
||||
|
||||
if (sanitizeAndCheckVideoTorrentObject(body) === false || checkUrlsSameHost(body.id, videoUrl) !== true) {
|
||||
logger.debug('Remote video JSON is not valid.', { body })
|
||||
logger.debug('Remote video JSON is not valid.', { body, ...lTags(videoUrl) })
|
||||
|
||||
return { statusCode, videoObject: undefined }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue