Check that reactions are not from blocked accounts

main
bashrc 2026-01-08 14:52:59 +00:00
parent 3e42a977b1
commit db4a8ca445
7 changed files with 28 additions and 10 deletions

View File

@ -1342,8 +1342,8 @@ def show_conversation_thread(self, authorized: bool,
access_keys: {},
min_images_for_accounts: [],
buy_sites: [],
blocked_cache: {},
block_federated: {},
blocked_cache: [],
block_federated: [],
auto_cw_cache: {},
default_timeline: str,
mitm_servers: [],

View File

@ -48,7 +48,7 @@ def moderator_actions(self, path: str, calling_domain: str, cookie: str,
theme_name: str,
access_keys: {}, person_cache: {},
recent_posts_cache: {},
blocked_cache: {},
blocked_cache: [],
mitm_servers: []) -> None:
"""Actions on the moderator screen
"""

View File

@ -821,7 +821,7 @@ def _read_local_box_post(session, nickname: str, domain: str,
translate: {}, your_actor: str,
domain_full: str, person_cache: {},
signing_priv_key_pem: str,
blocked_cache: {}, block_federated: [],
blocked_cache: [], block_federated: [],
bold_reading: bool,
mitm_servers: []) -> {}:
"""Reads a post from the given timeline

View File

@ -1960,7 +1960,9 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers, instance_software):
mitm_servers, instance_software,
server.blocked_cache,
server.block_federated):
if debug:
print('DEBUG: Reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,

View File

@ -1185,7 +1185,9 @@ def receive_reaction(recent_posts_cache: {},
buy_sites: {},
auto_cw_cache: {},
mitm_servers: [],
instance_software: {}) -> bool:
instance_software: {},
blocked_cache: [],
block_federated: []) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer
"""
if message_json['type'] != 'EmojiReact':
@ -1245,8 +1247,22 @@ def receive_reaction(recent_posts_cache: {},
print('DEBUG: emoji reaction post found in inbox')
reaction_actor = get_actor_from_post(message_json)
handle_name = handle.split('@')[0]
handle_dom = handle.split('@')[1]
# is the reaction actor blocked?
reaction_actor_nickname = get_nickname_from_actor(reaction_actor)
reaction_actor_domain, _ = get_domain_from_actor(reaction_actor)
if not reaction_actor_nickname or \
not reaction_actor_domain:
print("DEBUG: no reaction actor " + str(reaction_actor))
return True
if is_blocked(base_dir, handle_name, handle_dom,
reaction_actor_nickname, reaction_actor_domain,
blocked_cache, block_federated):
if debug:
print('BLOCK: reaction from ' +
reaction_actor_nickname + '@' + reaction_actor_domain +
' blocked')
return True
if not _already_reacted(base_dir,
handle_name, handle_dom,
post_reaction_id,

View File

@ -25,7 +25,7 @@ from conversation import post_id_to_convthread_id
def convert_torrent_to_note(base_dir: str, nickname: str, domain: str,
system_language: str,
post_json_object: {}, blocked_cache: {},
post_json_object: {}, blocked_cache: [],
block_federated: [],
languages_understood: []) -> {}:
"""Converts a Torrent ActivityPub(ish) object into

View File

@ -26,7 +26,7 @@ from conversation import post_id_to_convthread_id
def convert_video_to_note(base_dir: str, nickname: str, domain: str,
system_language: str,
post_json_object: {}, blocked_cache: {},
post_json_object: {}, blocked_cache: [],
block_federated: [],
languages_understood: []) -> {}:
"""Converts a PeerTube Video ActivityPub(ish) object into