mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
9d1ccd9ec6
commit
6a45908914
35
posts.py
35
posts.py
|
@ -2741,6 +2741,23 @@ def thread_send_post(session, post_json_str: str, federation_list: [],
|
||||||
tries += 1
|
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,
|
def send_post(signing_priv_key_pem: str, project_version: str,
|
||||||
session, base_dir: str, nickname: str, domain: str, port: int,
|
session, base_dir: str, nickname: str, domain: str, port: int,
|
||||||
to_nickname: str, to_domain: str, to_port: int, cc_str: str,
|
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
|
# NOTE: the inbox domain being sent to isn't always the same
|
||||||
# as the destination instance domain. eg public-api.wordpress.com
|
# as the destination instance domain. eg public-api.wordpress.com
|
||||||
# rather than the wordpress instance domain
|
# rather than the wordpress instance domain
|
||||||
inbox_url_domain, inbox_url_port = get_domain_from_actor(inbox_url)
|
to_domain = _get_inbox_domain(inbox_url, to_domain)
|
||||||
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
|
|
||||||
|
|
||||||
if to_domain not in inbox_url:
|
if to_domain not in inbox_url:
|
||||||
return 7
|
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
|
# NOTE: the inbox domain being sent to isn't always the same
|
||||||
# as the destination instance domain. eg public-api.wordpress.com
|
# as the destination instance domain. eg public-api.wordpress.com
|
||||||
# rather than the wordpress instance domain
|
# rather than the wordpress instance domain
|
||||||
inbox_url_domain, inbox_url_port = get_domain_from_actor(inbox_url)
|
to_domain = _get_inbox_domain(inbox_url, to_domain)
|
||||||
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
|
|
||||||
|
|
||||||
if to_domain not in inbox_url:
|
if to_domain not in inbox_url:
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in New Issue