ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix infinite loop in AP crawl
Chocobozzz76226d856852
diff --git a/server/core/lib/activitypub/crawl.ts b/server/core/lib/activitypub/crawl.tsindex bc773279ac..d7c645fbd9 100644--- a/server/core/lib/activitypub/crawl.ts+++ b/server/core/lib/activitypub/crawl.ts@@ -6,10 +6,10 @@ import { logger } from '../../helpers/logger.js'import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants.js'import { fetchAP } from './activity.js'-type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)+type HandlerFunction<T> = (items: T[]) => Promise<any> | Bluebird<any>type CleanerFunction = (startedDate: Date) => Promise<any>-async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction<T>, cleaner?: CleanerFunction) {+export async function crawlCollectionPage<T> (argUrl: string, handler: HandlerFunction<T>, cleaner?: CleanerFunction) {let url = argUrllogger.info('Crawling ActivityPub data on %s.', url)@@ -23,6 +23,8 @@ async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunctionlet i = 0let nextLink = firstBody.firstwhile (nextLink && i < limit) {+ i+++let body: anyif (typeof nextLink === 'string') {@@ -40,7 +42,6 @@ async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction}nextLink = body.next- i++if (Array.isArray(body.orderedItems)) {const items = body.orderedItems@@ -52,7 +53,3 @@ async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunctionif (cleaner) await retryTransactionWrapper(cleaner, startDate)}--export {- crawlCollectionPage-}