mirror of https://gitlab.com/bashrc2/epicyon
Reject quote toots
parent
8d4a9a0ff4
commit
aa2f2de21c
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 is_quote_toot
|
||||
from utils import acct_handle_dir
|
||||
from utils import is_account_dir
|
||||
from utils import remove_eol
|
||||
|
@ -656,6 +657,10 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
|
|||
post_domain = get_full_domain(post_domain, post_port)
|
||||
|
||||
if has_object_dict(post_json_object):
|
||||
if is_quote_toot(post_json_object):
|
||||
if debug:
|
||||
print('REJECT: inbox quote toot ' + str(post_json_object))
|
||||
return None
|
||||
if post_json_object['object'].get('inReplyTo'):
|
||||
if isinstance(post_json_object['object']['inReplyTo'], str):
|
||||
in_reply_to = \
|
||||
|
|
|
@ -31,6 +31,7 @@ from utils import save_json
|
|||
from utils import acct_dir
|
||||
from utils import local_actor_url
|
||||
from utils import has_actor
|
||||
from utils import is_quote_toot
|
||||
from blocking import is_blocked_domain
|
||||
from blocking import outbox_block
|
||||
from blocking import outbox_undo_block
|
||||
|
@ -263,6 +264,10 @@ def post_message_to_outbox(session, translate: {},
|
|||
# check that the outgoing post doesn't contain any markup
|
||||
# which can be used to implement exploits
|
||||
if has_object_dict(message_json):
|
||||
if is_quote_toot(message_json):
|
||||
print('REJECT: POST quote toot ' + str(message_json))
|
||||
return False
|
||||
|
||||
content_str = get_base_content_from_post(message_json, system_language)
|
||||
if content_str:
|
||||
_capitalize_hashtag(content_str, message_json,
|
||||
|
|
8
utils.py
8
utils.py
|
@ -4127,3 +4127,11 @@ def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> []:
|
|||
print('EX: failed to delete reverse ' +
|
||||
reverse_filename)
|
||||
break
|
||||
|
||||
|
||||
def is_quote_toot(post_json_object: str) -> bool:
|
||||
"""Returns true if the given post is a quote toot
|
||||
"""
|
||||
if post_json_object['object'].get('quoteUri'):
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue