mirror of https://gitlab.com/bashrc2/epicyon
Reject quote toot based upon content
parent
fe53b43b60
commit
8d8582d725
12
inbox.py
12
inbox.py
|
@ -658,11 +658,12 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
|
|||
return None
|
||||
post_domain = get_full_domain(post_domain, post_port)
|
||||
|
||||
content_str = \
|
||||
get_base_content_from_post(post_json_object, system_language)
|
||||
|
||||
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 is_quote_toot(post_json_object, content_str):
|
||||
print('REJECT: inbox quote toot ' + str(post_json_object))
|
||||
if post_json_object['object'].get('inReplyTo'):
|
||||
if isinstance(post_json_object['object']['inReplyTo'], str):
|
||||
in_reply_to = \
|
||||
|
@ -690,8 +691,6 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
|
|||
return None
|
||||
|
||||
# filter on the content of the post
|
||||
content_str = \
|
||||
get_base_content_from_post(post_json_object, system_language)
|
||||
if content_str:
|
||||
summary_str = \
|
||||
get_summary_from_post(post_json_object,
|
||||
|
@ -3312,6 +3311,7 @@ def _like_notify(base_dir: str, domain: str,
|
|||
liker_handle = actor
|
||||
if liker_handle == handle:
|
||||
return
|
||||
|
||||
like_str = liker_handle + ' ' + url + '?likedBy=' + actor
|
||||
prev_like_file = account_dir + '/.prevLike'
|
||||
# was there a previous like notification?
|
||||
|
|
|
@ -265,7 +265,7 @@ 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):
|
||||
if is_quote_toot(message_json, ''):
|
||||
print('REJECT: POST quote toot ' + str(message_json))
|
||||
return False
|
||||
|
||||
|
|
5
utils.py
5
utils.py
|
@ -4161,7 +4161,7 @@ def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> []:
|
|||
break
|
||||
|
||||
|
||||
def is_quote_toot(post_json_object: str) -> bool:
|
||||
def is_quote_toot(post_json_object: str, content: str) -> bool:
|
||||
"""Returns true if the given post is a quote toot
|
||||
"""
|
||||
# Pleroma implementation
|
||||
|
@ -4187,6 +4187,9 @@ def is_quote_toot(post_json_object: str) -> bool:
|
|||
if 'json' not in item['mediaType']:
|
||||
continue
|
||||
return True
|
||||
if content:
|
||||
if 'QT: ' in content:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue