component AP gateway: fix AP media type in GET and POST requests headers
This commit is contained in:
parent
1075e86865
commit
68c47bc78b
3 changed files with 11 additions and 8 deletions
|
|
@ -377,7 +377,6 @@ class APGateway:
|
|||
url,
|
||||
headers = {
|
||||
"Accept": [MEDIA_TYPE_AP],
|
||||
"Content-Type": [MEDIA_TYPE_AP],
|
||||
}
|
||||
)
|
||||
if resp.code >= 300:
|
||||
|
|
@ -1345,7 +1344,7 @@ class APGateway:
|
|||
"Digest": digest
|
||||
}
|
||||
headers["Content-Type"] = (
|
||||
'application/activity+json'
|
||||
MEDIA_TYPE_AP
|
||||
)
|
||||
headers, __ = self.get_signature_data(self.get_key_id(actor_id), headers)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ TYPE_REACTION = "EmojiReact"
|
|||
TYPE_EVENT = "Event"
|
||||
TYPE_JOIN = "Join"
|
||||
TYPE_LEAVE = "Leave"
|
||||
MEDIA_TYPE_AP = "application/activity+json"
|
||||
MEDIA_TYPE_AP = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
MEDIA_TYPE_AP_ALT = "application/activity+json"
|
||||
NS_AP = "https://www.w3.org/ns/activitystreams"
|
||||
NS_AP_PUBLIC = f"{NS_AP}#Public"
|
||||
# 3 values can be used, see https://www.w3.org/TR/activitypub/#public-addressing
|
||||
|
|
|
|||
|
|
@ -41,10 +41,11 @@ from libervia.backend.tools.common import date_utils, uri
|
|||
from libervia.backend.memory.sqla_mapping import SubscriptionState
|
||||
|
||||
from .constants import (
|
||||
NS_AP, MEDIA_TYPE_AP, CONTENT_TYPE_WEBFINGER, CONTENT_TYPE_AP, TYPE_ACTOR, TYPE_INBOX,
|
||||
TYPE_SHARED_INBOX, TYPE_OUTBOX, TYPE_EVENT, AP_REQUEST_TYPES, PAGE_SIZE,
|
||||
ACTIVITY_TYPES_LOWER, ACTIVIY_NO_ACCOUNT_ALLOWED, SIGN_HEADERS, HS2019, SIGN_EXP,
|
||||
TYPE_FOLLOWERS, TYPE_FOLLOWING, TYPE_ITEM, TYPE_LIKE, TYPE_REACTION, ST_AP_CACHE
|
||||
NS_AP, MEDIA_TYPE_AP, MEDIA_TYPE_AP_ALT, CONTENT_TYPE_WEBFINGER, CONTENT_TYPE_AP,
|
||||
TYPE_ACTOR, TYPE_INBOX, TYPE_SHARED_INBOX, TYPE_OUTBOX, TYPE_EVENT, AP_REQUEST_TYPES,
|
||||
PAGE_SIZE, ACTIVITY_TYPES_LOWER, ACTIVIY_NO_ACCOUNT_ALLOWED, SIGN_HEADERS, HS2019,
|
||||
SIGN_EXP, TYPE_FOLLOWERS, TYPE_FOLLOWING, TYPE_ITEM, TYPE_LIKE, TYPE_REACTION,
|
||||
ST_AP_CACHE
|
||||
)
|
||||
from .regex import RE_SIG_PARAM
|
||||
|
||||
|
|
@ -968,7 +969,9 @@ class HTTPAPGServer(web_resource.Resource):
|
|||
path
|
||||
)
|
||||
request_type, extra_args = self.apg.parse_apurl(ap_url)
|
||||
if ((MEDIA_TYPE_AP not in (request.getHeader("accept") or "")
|
||||
header_accept = request.getHeader("accept") or ""
|
||||
if ((MEDIA_TYPE_AP not in header_accept
|
||||
and MEDIA_TYPE_AP_ALT not in header_accept
|
||||
and request_type in self.apg.html_redirect)):
|
||||
# this is not a AP request, and we have a redirections for it
|
||||
kw = {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue