diff options
author | mira.bat <97340105+irafire@users.noreply.github.com> | 2023-07-27 17:01:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 17:01:15 +0200 |
commit | f862be2749b4f2d8dee99128d7e3064a69920e11 (patch) | |
tree | 20643166e07cb31ca3e0d05b4490000150b2f1c4 /server/lib/job-queue/handlers/activitypub-cleaner.ts | |
parent | 787d822cd471d1e4bd5a37c687c78cd5f69d8645 (diff) | |
download | PeerTube-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.ts | 5 |
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' |
8 | import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments' | 8 | import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments' |
9 | import { doJSONRequest, PeerTubeRequestError } from '@server/helpers/requests' | 9 | import { PeerTubeRequestError } from '@server/helpers/requests' |
10 | import { AP_CLEANER } from '@server/initializers/constants' | 10 | import { AP_CLEANER } from '@server/initializers/constants' |
11 | import { fetchAP } from '@server/lib/activitypub/activity' | ||
11 | import { checkUrlsSameHost } from '@server/lib/activitypub/url' | 12 | import { checkUrlsSameHost } from '@server/lib/activitypub/url' |
12 | import { Redis } from '@server/lib/redis' | 13 | import { Redis } from '@server/lib/redis' |
13 | import { VideoModel } from '@server/models/video/video' | 14 | import { 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`) |