forked from indymedia/epicyon
				
			Check that posts don't contain replies from blocked domains
							parent
							
								
									b9d853ef63
								
							
						
					
					
						commit
						9aa4837775
					
				|  | @ -116,6 +116,11 @@ 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 | ||||||
|  |     evilDomains=['gab.com','gabfed.com','spinster.xyz'] | ||||||
|  |     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(): | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								inbox.py
								
								
								
								
							
							
						
						
									
										8
									
								
								inbox.py
								
								
								
								
							|  | @ -208,6 +208,14 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str, \ | ||||||
| 
 | 
 | ||||||
|     if postJsonObject.get('object'): |     if postJsonObject.get('object'): | ||||||
|         if isinstance(postJsonObject['object'], dict): |         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 postJsonObject['object'].get('content'): | ||||||
|                 if isinstance(postJsonObject['object']['content'], str): |                 if isinstance(postJsonObject['object']['content'], str): | ||||||
|                     if isFiltered(baseDir,nickname,domain,postJsonObject['object']['content']): |                     if isFiltered(baseDir,nickname,domain,postJsonObject['object']['content']): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue