mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
3529797d04
commit
956c20fa2c
10
inbox.py
10
inbox.py
|
@ -18,7 +18,6 @@ from languages import understood_post_language
|
||||||
from like import update_likes_collection
|
from like import update_likes_collection
|
||||||
from reaction import update_reaction_collection
|
from reaction import update_reaction_collection
|
||||||
from reaction import valid_emoji_content
|
from reaction import valid_emoji_content
|
||||||
from utils import get_statuses_list
|
|
||||||
from utils import quote_toots_allowed
|
from utils import quote_toots_allowed
|
||||||
from utils import get_post_attachments
|
from utils import get_post_attachments
|
||||||
from utils import lines_in_file
|
from utils import lines_in_file
|
||||||
|
@ -3229,15 +3228,8 @@ def _receive_announce(recent_posts_cache: {},
|
||||||
print('DEBUG: self-boost rejected')
|
print('DEBUG: self-boost rejected')
|
||||||
return False
|
return False
|
||||||
if not has_users_path(message_json['object']):
|
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
|
# 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']))
|
print('WARN: unknown users path ' + str(message_json['object']))
|
||||||
if debug:
|
if debug:
|
||||||
print('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)
|
separators, invalid_strings)
|
||||||
|
|
||||||
|
|
||||||
def get_statuses_list() -> []:
|
def _get_statuses_list() -> []:
|
||||||
"""Returns a list of statuses path strings
|
"""Returns a list of statuses path strings
|
||||||
"""
|
"""
|
||||||
return ('/statuses/', '/objects/', '/honk/', '/p/', '/h/', '/api/posts/',
|
return ('/statuses/', '/objects/', '/honk/', '/p/', '/h/', '/api/posts/',
|
||||||
|
@ -1661,7 +1661,7 @@ def get_statuses_list() -> []:
|
||||||
def contains_statuses(url: str) -> bool:
|
def contains_statuses(url: str) -> bool:
|
||||||
"""Whether the given url contains /statuses/
|
"""Whether the given url contains /statuses/
|
||||||
"""
|
"""
|
||||||
statuses_list = get_statuses_list()
|
statuses_list = _get_statuses_list()
|
||||||
for status_str in statuses_list:
|
for status_str in statuses_list:
|
||||||
if status_str in url:
|
if status_str in url:
|
||||||
return True
|
return True
|
||||||
|
@ -1674,7 +1674,7 @@ def get_actor_from_post_id(post_id: str) -> str:
|
||||||
https://somedomain/users/nick
|
https://somedomain/users/nick
|
||||||
"""
|
"""
|
||||||
actor = post_id
|
actor = post_id
|
||||||
statuses_list = get_statuses_list()
|
statuses_list = _get_statuses_list()
|
||||||
pixelfed_style_statuses = ['/p/']
|
pixelfed_style_statuses = ['/p/']
|
||||||
for status_str in statuses_list:
|
for status_str in statuses_list:
|
||||||
if status_str not in actor:
|
if status_str not in actor:
|
||||||
|
|
Loading…
Reference in New Issue