From 93f2b292f29a97c6bfabc22ed04b8697d85734d2 Mon Sep 17 00:00:00 2001 From: bashrc Date: Tue, 21 Jul 2026 11:47:36 +0100 Subject: [PATCH] Flag to allow an account to be added to lists --- src/collections.py | 10 ++++++++++ src/inbox_receive.py | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/collections.py b/src/collections.py index 7107ee179..d9e836978 100644 --- a/src/collections.py +++ b/src/collections.py @@ -309,3 +309,13 @@ def store_feature_authorization(base_dir: str, nickname: str, domain: str, if not is_a_file(feature_authorization_filename): return False return save_json(featured_item, feature_authorization_filename) + + +def allow_lists(base_dir: str, nickname: str, domain: str) -> bool: + """Is the given account permitted to be added to lists + """ + lists_permitted_filename = \ + acct_dir(base_dir, nickname, domain) + '/.allow_lists' + if is_a_file(lists_permitted_filename): + return True + return False diff --git a/src/inbox_receive.py b/src/inbox_receive.py index b8c3527b2..b4f19bc5f 100644 --- a/src/inbox_receive.py +++ b/src/inbox_receive.py @@ -101,6 +101,7 @@ from src.acceptreject import create_feature_reject from src.acceptreject import create_feature_accept from src.posts import send_signed_json from src.collections import store_feature_authorization +from src.collections import allow_lists def inbox_update_index(boxname: str, base_dir: str, handle: str, @@ -1214,12 +1215,12 @@ def receive_feature_request(session, return False handle_nickname = handle.split('@')[0] - handle_domain = handle.split('@')[0] mutuals: list[str] = \ - get_mutuals_of_person(base_dir, handle_nickname, handle_domain) + get_mutuals_of_person(base_dir, handle_nickname, domain) new_featured_item = None - if sender_handle not in mutuals: + if allow_lists(base_dir, handle_nickname, domain) and \ + sender_handle + '\n' not in mutuals: acceptreject_json = \ create_feature_reject(federation_list, actor_nickname, actor_domain, actor_port, @@ -1297,7 +1298,7 @@ def receive_feature_request(session, system_language, mitm_servers) == 0: if new_featured_item: store_feature_authorization(base_dir, - handle_nickname, handle_domain, + handle_nickname, domain, new_featured_item) return True