main
Bob Mottram 2023-06-27 19:33:48 +01:00
parent 35fab69ccd
commit 8fc6a3c0b6
1 changed files with 28 additions and 30 deletions

View File

@ -17269,6 +17269,7 @@ class PubServer(BaseHTTPRequestHandler):
print('Authorization token refused for ' + print('Authorization token refused for ' +
'offers collection federation') 'offers collection federation')
# show offers collection for federation # show offers collection for federation
offers_json = []
if self._has_accept(calling_domain) and \ if self._has_accept(calling_domain) and \
offers_collection_authorized: offers_collection_authorized:
if self.server.debug: if self.server.debug:
@ -17296,21 +17297,19 @@ class PubServer(BaseHTTPRequestHandler):
max_shares_per_account, max_shares_per_account,
shared_items_federated_domains, shared_items_federated_domains,
'shares') 'shares')
msg_str = json.dumps(offers_json, msg_str = json.dumps(offers_json,
ensure_ascii=False) ensure_ascii=False)
msg_str = self._convert_domains(calling_domain, msg_str = self._convert_domains(calling_domain,
referer_domain, referer_domain,
msg_str) msg_str)
msg = msg_str.encode('utf-8') msg = msg_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
accept_str = self.headers['Accept'] accept_str = self.headers['Accept']
protocol_str = \ protocol_str = \
get_json_content_from_accept(accept_str) get_json_content_from_accept(accept_str)
self._set_headers(protocol_str, msglen, self._set_headers(protocol_str, msglen,
None, calling_domain, False) None, calling_domain, False)
self._write(msg) self._write(msg)
return
self._400()
return return
# wanted items collection for this instance # wanted items collection for this instance
@ -17351,6 +17350,7 @@ class PubServer(BaseHTTPRequestHandler):
print('Authorization token refused for ' + print('Authorization token refused for ' +
'wanted collection federation') 'wanted collection federation')
# show wanted collection for federation # show wanted collection for federation
wanted_json = []
if self._has_accept(calling_domain) and \ if self._has_accept(calling_domain) and \
wanted_collection_authorized: wanted_collection_authorized:
if self.server.debug: if self.server.debug:
@ -17378,21 +17378,19 @@ class PubServer(BaseHTTPRequestHandler):
max_shares_per_account, max_shares_per_account,
shared_items_federated_domains, shared_items_federated_domains,
'wanted') 'wanted')
msg_str = json.dumps(wanted_json, msg_str = json.dumps(wanted_json,
ensure_ascii=False) ensure_ascii=False)
msg_str = self._convert_domains(calling_domain, msg_str = self._convert_domains(calling_domain,
referer_domain, referer_domain,
msg_str) msg_str)
msg = msg_str.encode('utf-8') msg = msg_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
accept_str = self.headers['Accept'] accept_str = self.headers['Accept']
protocol_str = \ protocol_str = \
get_json_content_from_accept(accept_str) get_json_content_from_accept(accept_str)
self._set_headers(protocol_str, msglen, self._set_headers(protocol_str, msglen,
None, calling_domain, False) None, calling_domain, False)
self._write(msg) self._write(msg)
return
self._400()
return return
# shared items catalog for this instance # shared items catalog for this instance