1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Use got instead of request

This commit is contained in:
Chocobozzz 2021-03-08 14:24:11 +01:00
parent 71926aae07
commit db4b15f21f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
32 changed files with 346 additions and 328 deletions

View file

@ -1,6 +1,6 @@
import * as express from 'express'
import { sanitizeUrl } from '@server/helpers/core-utils'
import { doRequest } from '@server/helpers/requests'
import { doJSONRequest } from '@server/helpers/requests'
import { CONFIG } from '@server/initializers/config'
import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/videos'
import { AccountBlocklistModel } from '@server/models/account/account-blocklist'
@ -94,9 +94,9 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e
try {
logger.debug('Doing video channels search index request on %s.', url, { body })
const searchIndexResult = await doRequest<ResultList<VideoChannel>>({ uri: url, body, json: true })
const searchIndexResult = await doJSONRequest<ResultList<VideoChannel>>(url, { json: body })
return res.json(searchIndexResult.body)
return res.json(searchIndexResult)
} catch (err) {
logger.warn('Cannot use search index to make video channels search.', { err })
@ -186,9 +186,9 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons
try {
logger.debug('Doing videos search index request on %s.', url, { body })
const searchIndexResult = await doRequest<ResultList<Video>>({ uri: url, body, json: true })
const searchIndexResult = await doJSONRequest<ResultList<Video>>(url, { json: body })
return res.json(searchIndexResult.body)
return res.json(searchIndexResult)
} catch (err) {
logger.warn('Cannot use search index to make video search.', { err })