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: {}, access_keys: {},
min_images_for_accounts: [], min_images_for_accounts: [],
buy_sites: [], buy_sites: [],
blocked_cache: {}, blocked_cache: [],
block_federated: {}, block_federated: [],
auto_cw_cache: {}, auto_cw_cache: {},
default_timeline: str, default_timeline: str,
mitm_servers: [], mitm_servers: [],

View File

@ -48,7 +48,7 @@ def moderator_actions(self, path: str, calling_domain: str, cookie: str,
theme_name: str, theme_name: str,
access_keys: {}, person_cache: {}, access_keys: {}, person_cache: {},
recent_posts_cache: {}, recent_posts_cache: {},
blocked_cache: {}, blocked_cache: [],
mitm_servers: []) -> None: mitm_servers: []) -> None:
"""Actions on the moderator screen """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, translate: {}, your_actor: str,
domain_full: str, person_cache: {}, domain_full: str, person_cache: {},
signing_priv_key_pem: str, signing_priv_key_pem: str,
blocked_cache: {}, block_federated: [], blocked_cache: [], block_federated: [],
bold_reading: bool, bold_reading: bool,
mitm_servers: []) -> {}: mitm_servers: []) -> {}:
"""Reads a post from the given timeline """Reads a post from the given timeline

View File

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

View File

@ -1185,7 +1185,9 @@ def receive_reaction(recent_posts_cache: {},
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, auto_cw_cache: {},
mitm_servers: [], mitm_servers: [],
instance_software: {}) -> bool: instance_software: {},
blocked_cache: [],
block_federated: []) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer """Receives an emoji reaction within the POST section of HTTPServer
""" """
if message_json['type'] != 'EmojiReact': if message_json['type'] != 'EmojiReact':
@ -1245,8 +1247,22 @@ def receive_reaction(recent_posts_cache: {},
print('DEBUG: emoji reaction post found in inbox') print('DEBUG: emoji reaction post found in inbox')
reaction_actor = get_actor_from_post(message_json) reaction_actor = get_actor_from_post(message_json)
handle_name = handle.split('@')[0] # is the reaction actor blocked?
handle_dom = handle.split('@')[1] 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, if not _already_reacted(base_dir,
handle_name, handle_dom, handle_name, handle_dom,
post_reaction_id, 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, def convert_torrent_to_note(base_dir: str, nickname: str, domain: str,
system_language: str, system_language: str,
post_json_object: {}, blocked_cache: {}, post_json_object: {}, blocked_cache: [],
block_federated: [], block_federated: [],
languages_understood: []) -> {}: languages_understood: []) -> {}:
"""Converts a Torrent ActivityPub(ish) object into """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, def convert_video_to_note(base_dir: str, nickname: str, domain: str,
system_language: str, system_language: str,
post_json_object: {}, blocked_cache: {}, post_json_object: {}, blocked_cache: [],
block_federated: [], block_federated: [],
languages_understood: []) -> {}: languages_understood: []) -> {}:
"""Converts a PeerTube Video ActivityPub(ish) object into """Converts a PeerTube Video ActivityPub(ish) object into