diff options
Diffstat (limited to 'server/lib/job-queue/handlers/activitypub-cleaner.ts')
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-cleaner.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 0e75b0a6e..9dcc778fa 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts | |||
@@ -7,7 +7,7 @@ import { | |||
7 | isLikeActivityValid | 7 | isLikeActivityValid |
8 | } from '@server/helpers/custom-validators/activitypub/activity' | 8 | } from '@server/helpers/custom-validators/activitypub/activity' |
9 | import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments' | 9 | import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments' |
10 | import { doRequest } from '@server/helpers/requests' | 10 | import { doJSONRequest } from '@server/helpers/requests' |
11 | import { AP_CLEANER_CONCURRENCY } from '@server/initializers/constants' | 11 | import { AP_CLEANER_CONCURRENCY } from '@server/initializers/constants' |
12 | import { VideoModel } from '@server/models/video/video' | 12 | import { VideoModel } from '@server/models/video/video' |
13 | import { VideoCommentModel } from '@server/models/video/video-comment' | 13 | import { VideoCommentModel } from '@server/models/video/video-comment' |
@@ -81,15 +81,10 @@ async function updateObjectIfNeeded <T> ( | |||
81 | updater: (url: string, newUrl: string) => Promise<T>, | 81 | updater: (url: string, newUrl: string) => Promise<T>, |
82 | deleter: (url: string) => Promise<T> | 82 | deleter: (url: string) => Promise<T> |
83 | ): Promise<{ data: T, status: 'deleted' | 'updated' } | null> { | 83 | ): Promise<{ data: T, status: 'deleted' | 'updated' } | null> { |
84 | // Fetch url | 84 | const { statusCode, body } = await doJSONRequest<any>(url, { activityPub: true }) |
85 | const { response, body } = await doRequest<any>({ | ||
86 | uri: url, | ||
87 | json: true, | ||
88 | activityPub: true | ||
89 | }) | ||
90 | 85 | ||
91 | // Does not exist anymore, remove entry | 86 | // Does not exist anymore, remove entry |
92 | if (response.statusCode === HttpStatusCode.NOT_FOUND_404) { | 87 | if (statusCode === HttpStatusCode.NOT_FOUND_404) { |
93 | logger.info('Removing remote AP object %s.', url) | 88 | logger.info('Removing remote AP object %s.', url) |
94 | const data = await deleter(url) | 89 | const data = await deleter(url) |
95 | 90 | ||