mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
d32d6eb86d
commit
b52cc2d5be
4
inbox.py
4
inbox.py
|
@ -33,7 +33,7 @@ from utils import acct_dir
|
|||
from utils import remove_domain_port
|
||||
from utils import get_port_from_domain
|
||||
from utils import has_object_dict
|
||||
from utils import dmAllowedFromDomain
|
||||
from utils import dm_allowed_from_domain
|
||||
from utils import isRecentPost
|
||||
from utils import get_config_param
|
||||
from utils import has_users_path
|
||||
|
@ -2945,7 +2945,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
# check the follow
|
||||
if not isFollowingActor(base_dir, nickname, domain, sendH):
|
||||
# DMs may always be allowed from some domains
|
||||
if not dmAllowedFromDomain(base_dir,
|
||||
if not dm_allowed_from_domain(base_dir,
|
||||
nickname, domain,
|
||||
sendingActorDomain):
|
||||
# send back a bounce DM
|
||||
|
|
10
utils.py
10
utils.py
|
@ -2701,20 +2701,20 @@ def loadTranslationsFromFile(base_dir: str, language: str) -> ({}, str):
|
|||
return load_json(translationsFile), system_language
|
||||
|
||||
|
||||
def dmAllowedFromDomain(base_dir: str,
|
||||
def dm_allowed_from_domain(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
sendingActorDomain: str) -> bool:
|
||||
sending_actor_domain: str) -> bool:
|
||||
"""When a DM is received and the .followDMs flag file exists
|
||||
Then optionally some domains can be specified as allowed,
|
||||
regardless of individual follows.
|
||||
i.e. Mostly you only want DMs from followers, but there are
|
||||
a few particular instances that you trust
|
||||
"""
|
||||
dmAllowedInstancesFilename = \
|
||||
dm_allowed_instances_file = \
|
||||
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
||||
if not os.path.isfile(dmAllowedInstancesFilename):
|
||||
if not os.path.isfile(dm_allowed_instances_file):
|
||||
return False
|
||||
if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read():
|
||||
if sending_actor_domain + '\n' in open(dm_allowed_instances_file).read():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue