Fix Accept headers when fetching AP objects to match spec (#30354)

This commit is contained in:
Oneric
2025-11-05 14:32:29 +01:00
committed by GitHub
parent 3aeae8cafd
commit c0c6f5ea32
5 changed files with 5 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ class ActivityPub::Dereferencer
req = Request.new(:get, uri)
req.add_headers('Accept' => 'application/activity+json, application/ld+json')
req.add_headers('Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams", application/activity+json')
req.add_headers(headers) if headers
req.on_behalf_of(@signature_actor) if @signature_actor

View File

@@ -3,7 +3,7 @@
class FetchResourceService < BaseService
include JsonLdHelper
ACCEPT_HEADER = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams", text/html;q=0.1'
ACCEPT_HEADER = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams", application/activity+json, text/html;q=0.1'
ACTIVITY_STREAM_LINK_TYPES = ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].freeze
attr_reader :response_code

View File

@@ -6,6 +6,7 @@
%link{ rel: 'alternate', type: 'application/rss+xml', href: rss_url }/
%link{ rel: 'alternate', type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(@account) }/
%link{ rel: 'alternate', type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', href: ActivityPub::TagManager.instance.uri_for(@account) }/
- @account.fields.select(&:verifiable?).each do |field|
%link{ rel: 'me', type: 'text/html', href: field.value }/

View File

@@ -8,6 +8,7 @@
%link{ rel: 'alternate', type: 'application/json+oembed', href: api_oembed_url(url: short_account_status_url(@account, @status), format: 'json') }/
%link{ rel: 'alternate', type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(@status) }/
%link{ rel: 'alternate', type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', href: ActivityPub::TagManager.instance.uri_for(@status) }/
= opengraph 'og:site_name', site_title
= opengraph 'og:type', 'article'

View File

@@ -1,6 +1,7 @@
- content_for :header_tags do
%link{ rel: :alternate, type: 'application/rss+xml', href: tag_url(@tag) }/
%link{ rel: :alternate, type: 'application/activity+json', href: tag_url(@tag) }/
%link{ rel: :alternate, type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', href: tag_url(@tag) }/
%meta{ name: 'robots', content: 'noindex' }/
= render partial: 'shared/og'