Alternative actor formats

merge-requests/30/head
Bob Mottram 2021-07-31 18:14:25 +01:00
parent 4aa692e21d
commit 5c965a57e1
1 changed files with 10 additions and 2 deletions

View File

@ -9905,11 +9905,19 @@ class PubServer(BaseHTTPRequestHandler):
'show profile posts') 'show profile posts')
else: else:
if self._fetchAuthenticated(): if self._fetchAuthenticated():
acceptStr = self.headers['Accept']
msgStr = json.dumps(actorJson, ensure_ascii=False) msgStr = json.dumps(actorJson, ensure_ascii=False)
msg = msgStr.encode('utf-8') msg = msgStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('application/ld+json', msglen, if 'application/ld+json' in acceptStr:
cookie, callingDomain) self._set_headers('application/ld+json', msglen,
cookie, callingDomain)
elif 'application/jrd+json' in acceptStr:
self._set_headers('application/jrd+json', msglen,
cookie, callingDomain)
else:
self._set_headers('application/activity+json', msglen,
cookie, callingDomain)
self._write(msg) self._write(msg)
else: else:
self._404() self._404()