mirror of https://gitlab.com/bashrc2/epicyon
Set the user agent domain
parent
bef7946cbe
commit
58ad9243d6
14
posts.py
14
posts.py
|
@ -3287,7 +3287,8 @@ def send_to_named_addresses_thread(server, session, session_onion, session_i2p,
|
||||||
|
|
||||||
|
|
||||||
def _has_shared_inbox(session, http_prefix: str, domain: str,
|
def _has_shared_inbox(session, http_prefix: str, domain: str,
|
||||||
debug: bool, signing_priv_key_pem: str) -> bool:
|
debug: bool, signing_priv_key_pem: str,
|
||||||
|
ua_domain: str) -> bool:
|
||||||
"""Returns true if the given domain has a shared inbox
|
"""Returns true if the given domain has a shared inbox
|
||||||
This tries the new and the old way of webfingering the shared inbox
|
This tries the new and the old way of webfingering the shared inbox
|
||||||
"""
|
"""
|
||||||
|
@ -3297,7 +3298,7 @@ def _has_shared_inbox(session, http_prefix: str, domain: str,
|
||||||
try_handles.append('inbox@' + domain)
|
try_handles.append('inbox@' + domain)
|
||||||
for handle in try_handles:
|
for handle in try_handles:
|
||||||
wf_request = webfinger_handle(session, handle, http_prefix, {},
|
wf_request = webfinger_handle(session, handle, http_prefix, {},
|
||||||
domain, __version__, debug, False,
|
ua_domain, __version__, debug, False,
|
||||||
signing_priv_key_pem)
|
signing_priv_key_pem)
|
||||||
if wf_request:
|
if wf_request:
|
||||||
if isinstance(wf_request, dict):
|
if isinstance(wf_request, dict):
|
||||||
|
@ -3411,9 +3412,16 @@ def send_to_followers(server, session, session_onion, session_i2p,
|
||||||
curr_session = session_i2p
|
curr_session = session_i2p
|
||||||
curr_http_prefix = 'http'
|
curr_http_prefix = 'http'
|
||||||
|
|
||||||
|
# get the domain showin by the user agent
|
||||||
|
ua_domain = domain
|
||||||
|
if follower_domain.endswith('.onion'):
|
||||||
|
ua_domain = onion_domain
|
||||||
|
elif follower_domain.endswith('.i2p'):
|
||||||
|
ua_domain = i2p_domain
|
||||||
|
|
||||||
with_shared_inbox = \
|
with_shared_inbox = \
|
||||||
_has_shared_inbox(curr_session, curr_http_prefix, follower_domain,
|
_has_shared_inbox(curr_session, curr_http_prefix, follower_domain,
|
||||||
debug, signing_priv_key_pem)
|
debug, signing_priv_key_pem, ua_domain)
|
||||||
if debug:
|
if debug:
|
||||||
if with_shared_inbox:
|
if with_shared_inbox:
|
||||||
print(follower_domain + ' has shared inbox')
|
print(follower_domain + ' has shared inbox')
|
||||||
|
|
Loading…
Reference in New Issue