mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
8755d49d7f
commit
a90039b57a
|
@ -7,6 +7,7 @@ __email__ = "bob@freedombone.net"
|
||||||
__status__ = "Production"
|
__status__ = "Production"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from utils import isEvil
|
||||||
|
|
||||||
def addGlobalBlock(baseDir: str, \
|
def addGlobalBlock(baseDir: str, \
|
||||||
blockNickname: str,blockDomain: str) -> bool:
|
blockNickname: str,blockDomain: str) -> bool:
|
||||||
|
@ -116,11 +117,8 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \
|
||||||
blockNickname: str,blockDomain: str) -> bool:
|
blockNickname: str,blockDomain: str) -> bool:
|
||||||
"""Is the given nickname blocked?
|
"""Is the given nickname blocked?
|
||||||
"""
|
"""
|
||||||
# https://www.youtube.com/watch?v=5qw1hcevmdU
|
if isEvil(blockDomain):
|
||||||
evilDomains=['gab.com','gabfed.com','spinster.xyz']
|
return True
|
||||||
for concentratedEvil in evilDomains:
|
|
||||||
if blockDomain.endswith(concentratedEvil):
|
|
||||||
return True
|
|
||||||
globalBlockingFilename=baseDir+'/accounts/blocking.txt'
|
globalBlockingFilename=baseDir+'/accounts/blocking.txt'
|
||||||
if os.path.isfile(globalBlockingFilename):
|
if os.path.isfile(globalBlockingFilename):
|
||||||
if '*@'+blockDomain in open(globalBlockingFilename).read():
|
if '*@'+blockDomain in open(globalBlockingFilename).read():
|
||||||
|
|
15
utils.py
15
utils.py
|
@ -20,6 +20,14 @@ def getStatusNumber() -> (str,str):
|
||||||
published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
return statusNumber,published
|
return statusNumber,published
|
||||||
|
|
||||||
|
def isEvil(domain: str) -> bool:
|
||||||
|
# https://www.youtube.com/watch?v=5qw1hcevmdU
|
||||||
|
evilDomains=['gab.com','gabfed.com','spinster.xyz']
|
||||||
|
for concentratedEvil in evilDomains:
|
||||||
|
if domain.endswith(concentratedEvil):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def createPersonDir(nickname: str,domain: str,baseDir: str,dirname: str) -> str:
|
def createPersonDir(nickname: str,domain: str,baseDir: str,dirname: str) -> str:
|
||||||
"""Create a directory for a person
|
"""Create a directory for a person
|
||||||
"""
|
"""
|
||||||
|
@ -51,11 +59,8 @@ def domainPermitted(domain: str, federationList: []):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def urlPermitted(url: str, federationList: [],capability: str):
|
def urlPermitted(url: str, federationList: [],capability: str):
|
||||||
# https://www.youtube.com/watch?v=5qw1hcevmdU
|
if isEvil(url):
|
||||||
evilDomains=['gab.com','gabfed.com','spinster.xyz']
|
return False
|
||||||
for concentratedEvil in evilDomains:
|
|
||||||
if url.endswith(concentratedEvil):
|
|
||||||
return False
|
|
||||||
if len(federationList)==0:
|
if len(federationList)==0:
|
||||||
return True
|
return True
|
||||||
for domain in federationList:
|
for domain in federationList:
|
||||||
|
|
Loading…
Reference in New Issue