diff --git a/inbox.py b/inbox.py index 548b96c4d..b775ff7d2 100644 --- a/inbox.py +++ b/inbox.py @@ -18,7 +18,6 @@ from languages import understood_post_language from like import update_likes_collection from reaction import update_reaction_collection from reaction import valid_emoji_content -from utils import get_statuses_list from utils import quote_toots_allowed from utils import get_post_attachments from utils import lines_in_file @@ -3229,15 +3228,8 @@ def _receive_announce(recent_posts_cache: {}, print('DEBUG: self-boost rejected') return False if not has_users_path(message_json['object']): - # does the object contain a statuses path? - statuses = get_statuses_list() - status_path_found = False - for status_str in statuses: - if status_str in str(message_json['object']): - status_path_found = True - break # log any unrecognised statuses - if not status_path_found: + if not contains_statuses(str(message_json['object'])): print('WARN: unknown users path ' + str(message_json['object'])) if debug: print('DEBUG: ' + diff --git a/utils.py b/utils.py index 81bda866a..6be8f8fcd 100644 --- a/utils.py +++ b/utils.py @@ -1651,7 +1651,7 @@ def dangerous_svg(content: str, allow_local_network_access: bool) -> bool: separators, invalid_strings) -def get_statuses_list() -> []: +def _get_statuses_list() -> []: """Returns a list of statuses path strings """ return ('/statuses/', '/objects/', '/honk/', '/p/', '/h/', '/api/posts/', @@ -1661,7 +1661,7 @@ def get_statuses_list() -> []: def contains_statuses(url: str) -> bool: """Whether the given url contains /statuses/ """ - statuses_list = get_statuses_list() + statuses_list = _get_statuses_list() for status_str in statuses_list: if status_str in url: return True @@ -1674,7 +1674,7 @@ def get_actor_from_post_id(post_id: str) -> str: https://somedomain/users/nick """ actor = post_id - statuses_list = get_statuses_list() + statuses_list = _get_statuses_list() pixelfed_style_statuses = ['/p/'] for status_str in statuses_list: if status_str not in actor: