1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +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,5 +1,5 @@
import { chunk } from 'lodash'
import { doRequest } from '@server/helpers/requests'
import { doJSONRequest } from '@server/helpers/requests'
import { JobQueue } from '@server/lib/job-queue'
import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
import { getServerActor } from '@server/models/application/application'
@ -34,12 +34,12 @@ export class AutoFollowIndexInstances extends AbstractScheduler {
try {
const serverActor = await getServerActor()
const qs = { count: 1000 }
if (this.lastCheck) Object.assign(qs, { since: this.lastCheck.toISOString() })
const searchParams = { count: 1000 }
if (this.lastCheck) Object.assign(searchParams, { since: this.lastCheck.toISOString() })
this.lastCheck = new Date()
const { body } = await doRequest<any>({ uri: indexUrl, qs, json: true })
const { body } = await doJSONRequest<any>(indexUrl, { searchParams })
if (!body.data || Array.isArray(body.data) === false) {
logger.error('Cannot auto follow instances of index %s. Please check the auto follow URL.', indexUrl, { body })
return