diff --git a/blocking.py b/blocking.py index acd6f061..8318eded 100644 --- a/blocking.py +++ b/blocking.py @@ -116,6 +116,11 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \ blockNickname: str,blockDomain: str) -> bool: """Is the given nickname blocked? """ + # https://www.youtube.com/watch?v=5qw1hcevmdU + evilDomains=['gab.com','gabfed.com','spinster.xyz'] + for concentratedEvil in evilDomains: + if blockDomain.endswith(concentratedEvil): + return True globalBlockingFilename=baseDir+'/accounts/blocking.txt' if os.path.isfile(globalBlockingFilename): if '*@'+blockDomain in open(globalBlockingFilename).read(): diff --git a/inbox.py b/inbox.py index 348c595b..aca3ccf8 100644 --- a/inbox.py +++ b/inbox.py @@ -208,6 +208,14 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str, \ if postJsonObject.get('object'): if isinstance(postJsonObject['object'], dict): + if postJsonObject['object'].get('inReplyTo'): + if isinstance(postJsonObject['object']['inReplyTo'], str): + replyNickname=getNicknameFromActor(postJsonObject['object']['inReplyTo']) + replyDomain,replyPort=getDomainFromActor(postJsonObject['object']['inReplyTo']) + if replyNickname and replyDomain: + if isBlocked(baseDir,nickname,domain,postNickname,postDomain): + print('WARN: post contains reply from a blocked domain: '+replyDomain) + return None if postJsonObject['object'].get('content'): if isinstance(postJsonObject['object']['content'], str): if isFiltered(baseDir,nickname,domain,postJsonObject['object']['content']):