From db4b15f21fbf4e33434e930ffc7fb768cdcf9d42 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Mar 2021 14:24:11 +0100 Subject: Use got instead of request --- server/lib/activitypub/video-comments.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'server/lib/activitypub/video-comments.ts') diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index d025ed7f1..f1edfb0ac 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts @@ -1,13 +1,13 @@ +import * as Bluebird from 'bluebird' +import { checkUrlsSameHost } from '../../helpers/activitypub' import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' import { logger } from '../../helpers/logger' -import { doRequest } from '../../helpers/requests' +import { doJSONRequest } from '../../helpers/requests' import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' import { VideoCommentModel } from '../../models/video/video-comment' +import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video' import { getOrCreateActorAndServerAndModel } from './actor' import { getOrCreateVideoAndAccountAndChannel } from './videos' -import * as Bluebird from 'bluebird' -import { checkUrlsSameHost } from '../../helpers/activitypub' -import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video' type ResolveThreadParams = { url: string @@ -126,11 +126,7 @@ async function resolveRemoteParentComment (params: ResolveThreadParams) { throw new Error('Recursion limit reached when resolving a thread') } - const { body } = await doRequest({ - uri: url, - json: true, - activityPub: true - }) + const { body } = await doJSONRequest(url, { activityPub: true }) if (sanitizeAndCheckVideoCommentObject(body) === false) { throw new Error(`Remote video comment JSON ${url} is not valid:` + JSON.stringify(body)) -- cgit v1.2.3