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 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 contains_statuses
|
||||||
from utils import get_actor_from_post_id
|
from utils import get_actor_from_post_id
|
||||||
from utils import contains_invalid_actor_url_chars
|
from utils import contains_invalid_actor_url_chars
|
||||||
from utils import is_quote_toot
|
from utils import is_quote_toot
|
||||||
|
@ -978,9 +979,7 @@ def _inbox_post_recipients(base_dir: str, post_json_object: {},
|
||||||
else:
|
else:
|
||||||
if debug and post_json_object.get('object'):
|
if debug and post_json_object.get('object'):
|
||||||
if isinstance(post_json_object['object'], str):
|
if isinstance(post_json_object['object'], str):
|
||||||
if '/statuses/' in post_json_object['object'] or \
|
if contains_statuses(post_json_object['object']):
|
||||||
'/objects/' in post_json_object['object'] or \
|
|
||||||
'/p/' in post_json_object['object']:
|
|
||||||
print('DEBUG: inbox item is a link to a post')
|
print('DEBUG: inbox item is a link to a post')
|
||||||
else:
|
else:
|
||||||
if '/users/' in post_json_object['object']:
|
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 local_actor_url
|
||||||
from utils import dangerous_svg
|
from utils import dangerous_svg
|
||||||
from utils import text_in_file
|
from utils import text_in_file
|
||||||
|
from utils import contains_statuses
|
||||||
from session import get_json_valid
|
from session import get_json_valid
|
||||||
from session import create_session
|
from session import create_session
|
||||||
from session import get_json
|
from session import get_json
|
||||||
|
@ -1236,9 +1237,7 @@ def can_remove_post(base_dir: str,
|
||||||
domain: str, port: int, post_id: str) -> bool:
|
domain: str, port: int, post_id: str) -> bool:
|
||||||
"""Returns true if the given post can be removed
|
"""Returns true if the given post can be removed
|
||||||
"""
|
"""
|
||||||
if '/statuses/' not in post_id and \
|
if not contains_statuses(post_id):
|
||||||
'/objects/' not in post_id and \
|
|
||||||
'/p/' not in post_id:
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
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 httpsig import create_signed_header
|
||||||
from siteactive import site_is_active
|
from siteactive import site_is_active
|
||||||
from languages import understood_post_language
|
from languages import understood_post_language
|
||||||
|
from utils import contains_statuses
|
||||||
from utils import contains_invalid_actor_url_chars
|
from utils import contains_invalid_actor_url_chars
|
||||||
from utils import acct_handle_dir
|
from utils import acct_handle_dir
|
||||||
from utils import is_dm
|
from utils import is_dm
|
||||||
|
@ -5551,9 +5552,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
||||||
announced_json, blocked_cache)
|
announced_json, blocked_cache)
|
||||||
if converted_json:
|
if converted_json:
|
||||||
announced_json = converted_json
|
announced_json = converted_json
|
||||||
if '/statuses/' not in announced_json['id'] and \
|
if not contains_statuses(announced_json['id']):
|
||||||
'/objects/' not in announced_json['id'] and \
|
|
||||||
'/p/' not in announced_json['id']:
|
|
||||||
print('WARN: announced post id does not contain /statuses/ ' +
|
print('WARN: announced post id does not contain /statuses/ ' +
|
||||||
'or /objects/ or /p/ ' + str(announced_json))
|
'or /objects/ or /p/ ' + str(announced_json))
|
||||||
_reject_announce(announce_filename,
|
_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):
|
if isinstance(proxy_dict['protocol'], str):
|
||||||
return proxy_dict['protocol']
|
return proxy_dict['protocol']
|
||||||
return None
|
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