mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 08:19:05 +00:00
Fix Accept headers when fetching AP objects to match spec (#30354)
This commit is contained in:
@@ -44,7 +44,7 @@ class ActivityPub::Dereferencer
|
|||||||
|
|
||||||
req = Request.new(:get, uri)
|
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.add_headers(headers) if headers
|
||||||
req.on_behalf_of(@signature_actor) if @signature_actor
|
req.on_behalf_of(@signature_actor) if @signature_actor
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
class FetchResourceService < BaseService
|
class FetchResourceService < BaseService
|
||||||
include JsonLdHelper
|
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
|
ACTIVITY_STREAM_LINK_TYPES = ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].freeze
|
||||||
|
|
||||||
attr_reader :response_code
|
attr_reader :response_code
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
%link{ rel: 'alternate', type: 'application/rss+xml', href: rss_url }/
|
%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/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|
|
- @account.fields.select(&:verifiable?).each do |field|
|
||||||
%link{ rel: 'me', type: 'text/html', href: field.value }/
|
%link{ rel: 'me', type: 'text/html', href: field.value }/
|
||||||
|
|||||||
@@ -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/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/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:site_name', site_title
|
||||||
= opengraph 'og:type', 'article'
|
= opengraph 'og:type', 'article'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
- content_for :header_tags do
|
- content_for :header_tags do
|
||||||
%link{ rel: :alternate, type: 'application/rss+xml', href: tag_url(@tag) }/
|
%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/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' }/
|
%meta{ name: 'robots', content: 'noindex' }/
|
||||||
= render partial: 'shared/og'
|
= render partial: 'shared/og'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user