mirror of https://gitlab.com/bashrc2/epicyon
Less strict checking of announce id
parent
c5e83680b6
commit
adf98ebf93
5
inbox.py
5
inbox.py
|
@ -898,7 +898,8 @@ def _inbox_post_recipients(base_dir: str, post_json_object: {},
|
|||
else:
|
||||
if debug and post_json_object.get('object'):
|
||||
if isinstance(post_json_object['object'], str):
|
||||
if '/statuses/' in post_json_object['object']:
|
||||
if '/statuses/' in post_json_object['object'] or \
|
||||
'/objects/' in post_json_object['object']:
|
||||
print('DEBUG: inbox item is a link to a post')
|
||||
else:
|
||||
if '/users/' in post_json_object['object']:
|
||||
|
@ -2774,6 +2775,8 @@ def _receive_announce(recent_posts_cache: {},
|
|||
if has_users_path(lookup_actor):
|
||||
if '/statuses/' in lookup_actor:
|
||||
lookup_actor = lookup_actor.split('/statuses/')[0]
|
||||
elif '/objects/' in lookup_actor:
|
||||
lookup_actor = lookup_actor.split('/objects/')[0]
|
||||
|
||||
if is_recent_post(post_json_object, 3):
|
||||
if not os.path.isfile(post_filename + '.tts'):
|
||||
|
|
|
@ -1199,7 +1199,8 @@ def can_remove_post(base_dir: str,
|
|||
domain: str, port: int, post_id: str) -> bool:
|
||||
"""Returns true if the given post can be removed
|
||||
"""
|
||||
if '/statuses/' not in post_id:
|
||||
if '/statuses/' not in post_id and \
|
||||
'/objects/' not in post_id:
|
||||
return False
|
||||
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
|
10
posts.py
10
posts.py
|
@ -5240,6 +5240,9 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
announced_actor = announced_json['id']
|
||||
if announced_json.get('attributedTo'):
|
||||
announced_actor = announced_json['attributedTo']
|
||||
if not announced_json.get('type'):
|
||||
print('WARN: announced post does not have a type ' +
|
||||
str(announced_json))
|
||||
|
@ -5254,14 +5257,15 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
announced_json, blocked_cache)
|
||||
if converted_json:
|
||||
announced_json = converted_json
|
||||
if '/statuses/' not in announced_json['id']:
|
||||
if '/statuses/' not in announced_json['id'] and \
|
||||
'/objects/' not in announced_json['id']:
|
||||
print('WARN: announced post id does not contain /statuses/ ' +
|
||||
str(announced_json))
|
||||
'or /objects/' + str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not has_users_path(announced_json['id']):
|
||||
if not has_users_path(announced_actor):
|
||||
print('WARN: announced post id does not contain /users/ ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
|
|
Loading…
Reference in New Issue