mirror of https://gitlab.com/bashrc2/epicyon
Instance level allow list
parent
557ca1e787
commit
721ff8ddf5
28
blocking.py
28
blocking.py
|
@ -175,15 +175,27 @@ def isBlockedDomain(baseDir: str, domain: str) -> bool:
|
||||||
if noOfSections > 2:
|
if noOfSections > 2:
|
||||||
shortDomain = domain[noOfSections-2] + '.' + domain[noOfSections-1]
|
shortDomain = domain[noOfSections-2] + '.' + domain[noOfSections-1]
|
||||||
|
|
||||||
globalBlockingFilename = baseDir + '/accounts/blocking.txt'
|
allowFilename = baseDir + '/accounts/allowedinstances.txt'
|
||||||
if os.path.isfile(globalBlockingFilename):
|
if not os.path.isfile(allowFilename):
|
||||||
with open(globalBlockingFilename, 'r') as fpBlocked:
|
# instance block list
|
||||||
blockedStr = fpBlocked.read()
|
globalBlockingFilename = baseDir + '/accounts/blocking.txt'
|
||||||
if '*@' + domain in blockedStr:
|
if os.path.isfile(globalBlockingFilename):
|
||||||
return True
|
with open(globalBlockingFilename, 'r') as fpBlocked:
|
||||||
if shortDomain:
|
blockedStr = fpBlocked.read()
|
||||||
if '*@' + shortDomain in blockedStr:
|
if '*@' + domain in blockedStr:
|
||||||
return True
|
return True
|
||||||
|
if shortDomain:
|
||||||
|
if '*@' + shortDomain in blockedStr:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# instance allow list
|
||||||
|
if not shortDomain:
|
||||||
|
if domain not in open(allowFilename).read():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if shortDomain not in open(allowFilename).read():
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue