X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fcrawl.ts;h=eeafdf4ba8d04848242020af795f8fb4388cda8b;hb=de94ac86a211dec657332d964693857ec235ce40;hp=9e469e3e614c84a78f9d68bdd84922cfd481295b;hpb=a41b9da1a9ce49df82ea10c82de4c2fbc6d1b189;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index 9e469e3e6..eeafdf4ba 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts @@ -3,7 +3,7 @@ import { doRequest } from '../../helpers/requests' import { logger } from '../../helpers/logger' import * as Bluebird from 'bluebird' import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' -import { parse } from 'url' +import { URL } from 'url' type HandlerFunction = (items: T[]) => (Promise | Bluebird) type CleanerFunction = (startedDate: Date) => (Promise | Bluebird) @@ -24,7 +24,7 @@ async function crawlCollectionPage (uri: string, handler: HandlerFunction const response = await doRequest>(options) const firstBody = response.body - let limit = ACTIVITY_PUB.FETCH_PAGE_LIMIT + const limit = ACTIVITY_PUB.FETCH_PAGE_LIMIT let i = 0 let nextLink = firstBody.first while (nextLink && i < limit) { @@ -32,7 +32,7 @@ async function crawlCollectionPage (uri: string, handler: HandlerFunction if (typeof nextLink === 'string') { // Don't crawl ourselves - const remoteHost = parse(nextLink).host + const remoteHost = new URL(nextLink).host if (remoteHost === WEBSERVER.HOST) continue options.uri = nextLink