mirror of https://gitlab.com/bashrc2/epicyon
Flag to allow an account to be added to lists
parent
bb22f0e87d
commit
93f2b292f2
|
|
@ -309,3 +309,13 @@ def store_feature_authorization(base_dir: str, nickname: str, domain: str,
|
||||||
if not is_a_file(feature_authorization_filename):
|
if not is_a_file(feature_authorization_filename):
|
||||||
return False
|
return False
|
||||||
return save_json(featured_item, feature_authorization_filename)
|
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
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ from src.acceptreject import create_feature_reject
|
||||||
from src.acceptreject import create_feature_accept
|
from src.acceptreject import create_feature_accept
|
||||||
from src.posts import send_signed_json
|
from src.posts import send_signed_json
|
||||||
from src.collections import store_feature_authorization
|
from src.collections import store_feature_authorization
|
||||||
|
from src.collections import allow_lists
|
||||||
|
|
||||||
|
|
||||||
def inbox_update_index(boxname: str, base_dir: str, handle: str,
|
def inbox_update_index(boxname: str, base_dir: str, handle: str,
|
||||||
|
|
@ -1214,12 +1215,12 @@ def receive_feature_request(session,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
handle_nickname = handle.split('@')[0]
|
handle_nickname = handle.split('@')[0]
|
||||||
handle_domain = handle.split('@')[0]
|
|
||||||
mutuals: list[str] = \
|
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
|
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 = \
|
acceptreject_json = \
|
||||||
create_feature_reject(federation_list,
|
create_feature_reject(federation_list,
|
||||||
actor_nickname, actor_domain, actor_port,
|
actor_nickname, actor_domain, actor_port,
|
||||||
|
|
@ -1297,7 +1298,7 @@ def receive_feature_request(session,
|
||||||
system_language, mitm_servers) == 0:
|
system_language, mitm_servers) == 0:
|
||||||
if new_featured_item:
|
if new_featured_item:
|
||||||
store_feature_authorization(base_dir,
|
store_feature_authorization(base_dir,
|
||||||
handle_nickname, handle_domain,
|
handle_nickname, domain,
|
||||||
new_featured_item)
|
new_featured_item)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue