aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/video-comments.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-08 14:24:11 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 18:18:40 +0100
commitdb4b15f21fbf4e33434e930ffc7fb768cdcf9d42 (patch)
tree418117b84a5c2ee578c210288b698d155422d608 /server/lib/activitypub/video-comments.ts
parent71926aae0762facb25243f27eaf45933b5a37353 (diff)
downloadPeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.tar.gz
PeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.tar.zst
PeerTube-db4b15f21fbf4e33434e930ffc7fb768cdcf9d42.zip
Use got instead of request
Diffstat (limited to 'server/lib/activitypub/video-comments.ts')
-rw-r--r--server/lib/activitypub/video-comments.ts14
1 files changed, 5 insertions, 9 deletions
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 @@
1import * as Bluebird from 'bluebird'
2import { checkUrlsSameHost } from '../../helpers/activitypub'
1import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' 3import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
2import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
3import { doRequest } from '../../helpers/requests' 5import { doJSONRequest } from '../../helpers/requests'
4import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' 6import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
5import { VideoCommentModel } from '../../models/video/video-comment' 7import { VideoCommentModel } from '../../models/video/video-comment'
8import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'
6import { getOrCreateActorAndServerAndModel } from './actor' 9import { getOrCreateActorAndServerAndModel } from './actor'
7import { getOrCreateVideoAndAccountAndChannel } from './videos' 10import { getOrCreateVideoAndAccountAndChannel } from './videos'
8import * as Bluebird from 'bluebird'
9import { checkUrlsSameHost } from '../../helpers/activitypub'
10import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'
11 11
12type ResolveThreadParams = { 12type ResolveThreadParams = {
13 url: string 13 url: string
@@ -126,11 +126,7 @@ async function resolveRemoteParentComment (params: ResolveThreadParams) {
126 throw new Error('Recursion limit reached when resolving a thread') 126 throw new Error('Recursion limit reached when resolving a thread')
127 } 127 }
128 128
129 const { body } = await doRequest<any>({ 129 const { body } = await doJSONRequest<any>(url, { activityPub: true })
130 uri: url,
131 json: true,
132 activityPub: true
133 })
134 130
135 if (sanitizeAndCheckVideoCommentObject(body) === false) { 131 if (sanitizeAndCheckVideoCommentObject(body) === false) {
136 throw new Error(`Remote video comment JSON ${url} is not valid:` + JSON.stringify(body)) 132 throw new Error(`Remote video comment JSON ${url} is not valid:` + JSON.stringify(body))