diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-25 14:23:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-25 14:23:15 +0200 |
commit | c0e71e849a40871ed8eea3dacd8608d380bdb490 (patch) | |
tree | 0b6529213077acaafadbc5906e9de15855bcd920 /server/lib/activitypub | |
parent | 2b4dd7e26d93c2d9bef4f365cb03c511eff4ca8f (diff) | |
download | PeerTube-c0e71e849a40871ed8eea3dacd8608d380bdb490.tar.gz PeerTube-c0e71e849a40871ed8eea3dacd8608d380bdb490.tar.zst PeerTube-c0e71e849a40871ed8eea3dacd8608d380bdb490.zip |
Fix user notifications tests
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/crawl.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index ba5b67bee..0ba59b47d 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts | |||
@@ -1,8 +1,10 @@ | |||
1 | import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT } from '../../initializers/constants' | 1 | import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT, WEBSERVER } from '../../initializers/constants' |
2 | import { doRequest } from '../../helpers/requests' | 2 | import { doRequest } from '../../helpers/requests' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import * as Bluebird from 'bluebird' | 4 | import * as Bluebird from 'bluebird' |
5 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' | 5 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' |
6 | import { checkUrlsSameHost } from '../../helpers/activitypub' | ||
7 | import { parse } from "url" | ||
6 | 8 | ||
7 | type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>) | 9 | type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>) |
8 | type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>) | 10 | type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>) |
@@ -27,6 +29,10 @@ async function crawlCollectionPage <T> (uri: string, handler: HandlerFunction<T> | |||
27 | let i = 0 | 29 | let i = 0 |
28 | let nextLink = firstBody.first | 30 | let nextLink = firstBody.first |
29 | while (nextLink && i < limit) { | 31 | while (nextLink && i < limit) { |
32 | // Don't crawl ourselves | ||
33 | const remoteHost = parse(nextLink).host | ||
34 | if (remoteHost === WEBSERVER.HOST) continue | ||
35 | |||
30 | options.uri = nextLink | 36 | options.uri = nextLink |
31 | 37 | ||
32 | const { body } = await doRequest<ActivityPubOrderedCollection<T>>(options) | 38 | const { body } = await doRequest<ActivityPubOrderedCollection<T>>(options) |