mirror of https://gitlab.com/bashrc2/epicyon
Convert domain from onion/i2p to account handle
parent
7145900ff9
commit
e8de643760
|
@ -76,7 +76,9 @@ def create_reject(base_dir: str, federation_list: [],
|
||||||
|
|
||||||
|
|
||||||
def _accept_follow(base_dir: str, domain: str, message_json: {},
|
def _accept_follow(base_dir: str, domain: str, message_json: {},
|
||||||
federation_list: [], debug: bool) -> None:
|
federation_list: [], debug: bool,
|
||||||
|
curr_domain: str,
|
||||||
|
onion_domain: str, i2p_domain: str) -> None:
|
||||||
"""Receiving a follow Accept activity
|
"""Receiving a follow Accept activity
|
||||||
"""
|
"""
|
||||||
if not has_object_stringType(message_json, debug):
|
if not has_object_stringType(message_json, debug):
|
||||||
|
@ -144,6 +146,16 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
||||||
followed_actor)
|
followed_actor)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# convert from onion/i2p to clearnet accepted domain
|
||||||
|
if onion_domain:
|
||||||
|
if accepted_domain.endswith('.onion') and \
|
||||||
|
not curr_domain.endswith('.onion'):
|
||||||
|
accepted_domain = curr_domain
|
||||||
|
if i2p_domain:
|
||||||
|
if accepted_domain.endswith('.i2p') and \
|
||||||
|
not curr_domain.endswith('.i2p'):
|
||||||
|
accepted_domain = curr_domain
|
||||||
|
|
||||||
accepted_domain_full = accepted_domain
|
accepted_domain_full = accepted_domain
|
||||||
if accepted_port:
|
if accepted_port:
|
||||||
accepted_domain_full = accepted_domain + ':' + str(accepted_port)
|
accepted_domain_full = accepted_domain + ':' + str(accepted_port)
|
||||||
|
@ -189,7 +201,9 @@ def receive_accept_reject(session, base_dir: str,
|
||||||
cached_webfingers: {},
|
cached_webfingers: {},
|
||||||
person_cache: {}, message_json: {},
|
person_cache: {}, message_json: {},
|
||||||
federation_list: [],
|
federation_list: [],
|
||||||
debug: bool) -> bool:
|
debug: bool,
|
||||||
|
curr_domain: str,
|
||||||
|
onion_domain: str, i2p_domain: str) -> bool:
|
||||||
"""Receives an Accept or Reject within the POST section of HTTPServer
|
"""Receives an Accept or Reject within the POST section of HTTPServer
|
||||||
"""
|
"""
|
||||||
if message_json['type'] != 'Accept' and message_json['type'] != 'Reject':
|
if message_json['type'] != 'Accept' and message_json['type'] != 'Reject':
|
||||||
|
@ -215,7 +229,8 @@ def receive_accept_reject(session, base_dir: str,
|
||||||
' does not contain a nickname. ' +
|
' does not contain a nickname. ' +
|
||||||
'Assuming single user instance.')
|
'Assuming single user instance.')
|
||||||
# receive follow accept
|
# receive follow accept
|
||||||
_accept_follow(base_dir, domain, message_json, federation_list, debug)
|
_accept_follow(base_dir, domain, message_json, federation_list, debug,
|
||||||
|
curr_domain, onion_domain, i2p_domain)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Uh, ' + message_json['type'] + ', I guess')
|
print('DEBUG: Uh, ' + message_json['type'] + ', I guess')
|
||||||
return True
|
return True
|
||||||
|
|
3
inbox.py
3
inbox.py
|
@ -4602,7 +4602,8 @@ def run_inbox_queue(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
send_threads, post_log,
|
send_threads, post_log,
|
||||||
cached_webfingers, person_cache,
|
cached_webfingers, person_cache,
|
||||||
queue_json['post'],
|
queue_json['post'],
|
||||||
federation_list, debug):
|
federation_list, debug,
|
||||||
|
domain, onion_domain, i2p_domain):
|
||||||
print('Queue: Accept/Reject received from ' + key_id)
|
print('Queue: Accept/Reject received from ' + key_id)
|
||||||
if os.path.isfile(queue_filename):
|
if os.path.isfile(queue_filename):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue