mirror of https://gitlab.com/bashrc2/epicyon
Debug for rejected announces
parent
5730d7bff0
commit
438b6d59ce
28
posts.py
28
posts.py
|
@ -4842,18 +4842,22 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
return None
|
||||
|
||||
if not isinstance(announced_json, dict):
|
||||
print('WARN: announce json is not a dict - ' +
|
||||
print('WARN: announced post json is not a dict - ' +
|
||||
post_json_object['object'])
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not announced_json.get('id'):
|
||||
print('WARN: announced post does not have an id ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not announced_json.get('type'):
|
||||
print('WARN: announced post does not have a type ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
|
@ -4866,11 +4870,15 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
if converted_json:
|
||||
announced_json = converted_json
|
||||
if '/statuses/' not in announced_json['id']:
|
||||
print('WARN: announced post id does not contain /statuses/ ' +
|
||||
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']):
|
||||
print('WARN: announced post id does not contain /users/ ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
|
@ -4878,22 +4886,30 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
if announced_json['type'] != 'Note' and \
|
||||
announced_json['type'] != 'Page' and \
|
||||
announced_json['type'] != 'Article':
|
||||
print('WARN: announced post is not Note/Page/Article ' +
|
||||
str(announced_json))
|
||||
# You can only announce Note or Article types
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not announced_json.get('content'):
|
||||
print('WARN: announced post does not have content ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not announced_json.get('published'):
|
||||
print('WARN: announced post does not have published ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if not valid_post_date(announced_json['published'], 90, debug):
|
||||
print('WARN: announced post is not recently published ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
|
@ -4906,18 +4922,24 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
# Check the content of the announce
|
||||
content_str = announced_json['content']
|
||||
if dangerous_markup(content_str, allow_local_network_access):
|
||||
print('WARN: announced post contains dangerous markup ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
|
||||
if is_filtered(base_dir, nickname, domain, content_str):
|
||||
print('WARN: announced post has been filtered ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
|
||||
if invalid_ciphertext(content_str):
|
||||
print('WARN: announced post contains invalid ciphertext ' +
|
||||
str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
|
@ -4943,6 +4965,8 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
actor_nickname, actor_domain,
|
||||
actor_port, announced_json)
|
||||
if announced_json['type'] != 'Create':
|
||||
print('WARN: announced post could not be wrapped in Create ' +
|
||||
str(announced_json))
|
||||
# Create wrap failed
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
|
@ -4963,6 +4987,8 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
get_full_domain(attributed_domain, attributed_port)
|
||||
if is_blocked(base_dir, nickname, domain,
|
||||
attributed_nickname, attributed_domain):
|
||||
print('WARN: announced post handle is blocked ' +
|
||||
str(attributed_nickname) + '@' + attributed_domain)
|
||||
_reject_announce(announce_filename,
|
||||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
|
|
Loading…
Reference in New Issue