mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
134b4ec9b2
commit
3e1af39257
5
inbox.py
5
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 contains_statuses
|
||||
from utils import get_actor_from_post_id
|
||||
from utils import contains_invalid_actor_url_chars
|
||||
from utils import is_quote_toot
|
||||
|
@ -978,9 +979,7 @@ 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'] or \
|
||||
'/objects/' in post_json_object['object'] or \
|
||||
'/p/' in post_json_object['object']:
|
||||
if contains_statuses(post_json_object['object']):
|
||||
print('DEBUG: inbox item is a link to a post')
|
||||
else:
|
||||
if '/users/' in post_json_object['object']:
|
||||
|
|
|
@ -67,6 +67,7 @@ from utils import get_group_paths
|
|||
from utils import local_actor_url
|
||||
from utils import dangerous_svg
|
||||
from utils import text_in_file
|
||||
from utils import contains_statuses
|
||||
from session import get_json_valid
|
||||
from session import create_session
|
||||
from session import get_json
|
||||
|
@ -1236,9 +1237,7 @@ 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 and \
|
||||
'/objects/' not in post_id and \
|
||||
'/p/' not in post_id:
|
||||
if not contains_statuses(post_id):
|
||||
return False
|
||||
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
|
5
posts.py
5
posts.py
|
@ -34,6 +34,7 @@ from webfinger import webfinger_handle
|
|||
from httpsig import create_signed_header
|
||||
from siteactive import site_is_active
|
||||
from languages import understood_post_language
|
||||
from utils import contains_statuses
|
||||
from utils import contains_invalid_actor_url_chars
|
||||
from utils import acct_handle_dir
|
||||
from utils import is_dm
|
||||
|
@ -5551,9 +5552,7 @@ 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'] and \
|
||||
'/objects/' not in announced_json['id'] and \
|
||||
'/p/' not in announced_json['id']:
|
||||
if not contains_statuses(announced_json['id']):
|
||||
print('WARN: announced post id does not contain /statuses/ ' +
|
||||
'or /objects/ or /p/ ' + str(announced_json))
|
||||
_reject_announce(announce_filename,
|
||||
|
|
10
utils.py
10
utils.py
|
@ -4452,3 +4452,13 @@ def ap_proxy_type(json_object: {}) -> str:
|
|||
if isinstance(proxy_dict['protocol'], str):
|
||||
return proxy_dict['protocol']
|
||||
return None
|
||||
|
||||
|
||||
def contains_statuses(url: str) -> bool:
|
||||
"""Whether the given url contains /statuses/
|
||||
"""
|
||||
statuses_list = ('/statuses/', '/objects/', '/p/')
|
||||
for status_str in statuses_list:
|
||||
if status_str in url:
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue