merge-requests/30/head
Bob Mottram 2023-10-17 10:27:58 +01:00
parent 9d1ccd9ec6
commit 6a45908914
1 changed files with 19 additions and 16 deletions

View File

@ -2741,6 +2741,23 @@ def thread_send_post(session, post_json_str: str, federation_list: [],
tries += 1
def _get_inbox_domain(inbox_url: str, to_domain: str) -> str:
""" the inbox domain being sent to isn't always the same
as the destination instance domain. eg public-api.wordpress.com
rather than the wordpress instance domain
"""
inbox_url_domain, inbox_url_port = get_domain_from_actor(inbox_url)
if not inbox_url_domain:
return inbox_url
inbox_domain = get_full_domain(inbox_url_domain, inbox_url_port)
if inbox_domain != to_domain:
print('_get_inbox_domain ' +
'inbox domain is not the same as instance domain ' +
inbox_domain + ' != ' + to_domain)
return inbox_domain
return to_domain
def send_post(signing_priv_key_pem: str, project_version: str,
session, base_dir: str, nickname: str, domain: str, port: int,
to_nickname: str, to_domain: str, to_port: int, cc_str: str,
@ -2837,14 +2854,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
# NOTE: the inbox domain being sent to isn't always the same
# as the destination instance domain. eg public-api.wordpress.com
# rather than the wordpress instance domain
inbox_url_domain, inbox_url_port = get_domain_from_actor(inbox_url)
if inbox_url_domain:
inbox_domain = get_full_domain(inbox_url_domain, inbox_url_port)
if inbox_domain != to_domain:
print('send_post ' +
'inbox domain is not the same as instance domain ' +
inbox_domain + ' != ' + to_domain)
to_domain = inbox_domain
to_domain = _get_inbox_domain(inbox_url, to_domain)
if to_domain not in inbox_url:
return 7
@ -3272,14 +3282,7 @@ def send_signed_json(post_json_object: {}, session, base_dir: str,
# NOTE: the inbox domain being sent to isn't always the same
# as the destination instance domain. eg public-api.wordpress.com
# rather than the wordpress instance domain
inbox_url_domain, inbox_url_port = get_domain_from_actor(inbox_url)
if inbox_url_domain:
inbox_domain = get_full_domain(inbox_url_domain, inbox_url_port)
if inbox_domain != to_domain:
print('send_signed_json ' +
'inbox domain is not the same as instance domain ' +
inbox_domain + ' != ' + to_domain)
to_domain = inbox_domain
to_domain = _get_inbox_domain(inbox_url, to_domain)
if to_domain not in inbox_url:
if debug: