mirror of https://gitlab.com/bashrc2/epicyon
Check all possible statuses
parent
e3c04b01ce
commit
3d34b5895a
11
inbox.py
11
inbox.py
|
@ -18,6 +18,7 @@ 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
|
||||
|
@ -3228,7 +3229,15 @@ def _receive_announce(recent_posts_cache: {},
|
|||
print('DEBUG: self-boost rejected')
|
||||
return False
|
||||
if not has_users_path(message_json['object']):
|
||||
if '/objects/' not in str(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:
|
||||
print('WARN: unknown users path ' + str(message_json['object']))
|
||||
if debug:
|
||||
print('DEBUG: ' +
|
||||
|
|
6
utils.py
6
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:
|
||||
|
|
Loading…
Reference in New Issue