aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/activitypub-cleaner.ts
diff options
context:
space:
mode:
authormira.bat <97340105+irafire@users.noreply.github.com>2023-07-27 17:01:15 +0200
committerGitHub <noreply@github.com>2023-07-27 17:01:15 +0200
commitf862be2749b4f2d8dee99128d7e3064a69920e11 (patch)
tree20643166e07cb31ca3e0d05b4490000150b2f1c4 /server/lib/job-queue/handlers/activitypub-cleaner.ts
parent787d822cd471d1e4bd5a37c687c78cd5f69d8645 (diff)
downloadPeerTube-f862be2749b4f2d8dee99128d7e3064a69920e11.tar.gz
PeerTube-f862be2749b4f2d8dee99128d7e3064a69920e11.tar.zst
PeerTube-f862be2749b4f2d8dee99128d7e3064a69920e11.zip
Add an option to sign federated fetches for mastodon compatibility (#5898)
* Fix player error modal Not hidden when we change the video * Correctly dispose player components * Sign cross-server fetch requests for mastodon AUTHORIZED_FETCH compatibilty * Add a remote fetch sign configuration knob * Federated fetches refactoring --------- Co-authored-by: Chocobozzz <me@florianbigard.com> Co-authored-by: ira <ira@foxgirl.space>
Diffstat (limited to 'server/lib/job-queue/handlers/activitypub-cleaner.ts')
-rw-r--r--server/lib/job-queue/handlers/activitypub-cleaner.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts
index a25f00b0a..6ee9e2429 100644
--- a/server/lib/job-queue/handlers/activitypub-cleaner.ts
+++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts
@@ -6,8 +6,9 @@ import {
6 isLikeActivityValid 6 isLikeActivityValid
7} from '@server/helpers/custom-validators/activitypub/activity' 7} from '@server/helpers/custom-validators/activitypub/activity'
8import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments' 8import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments'
9import { doJSONRequest, PeerTubeRequestError } from '@server/helpers/requests' 9import { PeerTubeRequestError } from '@server/helpers/requests'
10import { AP_CLEANER } from '@server/initializers/constants' 10import { AP_CLEANER } from '@server/initializers/constants'
11import { fetchAP } from '@server/lib/activitypub/activity'
11import { checkUrlsSameHost } from '@server/lib/activitypub/url' 12import { checkUrlsSameHost } from '@server/lib/activitypub/url'
12import { Redis } from '@server/lib/redis' 13import { Redis } from '@server/lib/redis'
13import { VideoModel } from '@server/models/video/video' 14import { VideoModel } from '@server/models/video/video'
@@ -85,7 +86,7 @@ async function updateObjectIfNeeded <T> (options: {
85 } 86 }
86 87
87 try { 88 try {
88 const { body } = await doJSONRequest<any>(url, { activityPub: true }) 89 const { body } = await fetchAP<any>(url)
89 90
90 // If not same id, check same host and update 91 // If not same id, check same host and update
91 if (!body?.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`) 92 if (!body?.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`)