Default user agent blocks

main
Bob Mottram 2021-10-23 23:56:16 +01:00
parent d72a27b5cc
commit 8fe8701414
2 changed files with 10 additions and 2 deletions

View File

@ -520,11 +520,19 @@ class PubServer(BaseHTTPRequestHandler):
def _blockedUserAgent(self, callingDomain: str, agentStr: str) -> bool:
"""Should a GET or POST be blocked based upon its user agent?
"""
agentStrLower = agentStr.lower()
defaultAgentBlocks = (
'fedilist.com'
)
for uaBlock in defaultAgentBlocks:
if uaBlock in agentStrLower:
print('Blocked User agent: ' + uaBlock)
return True
agentDomain = None
if agentStr:
# is this a web crawler? If so the block it
agentStrLower = agentStr.lower()
if 'bot/' in agentStrLower or 'bot-' in agentStrLower:
if self.server.newsInstance:
return False

View File

@ -715,7 +715,7 @@ def getStatusNumber(publishedStr: str = None) -> (str, str):
def evilIncarnate() -> []:
return ('gab.com', 'gabfed.com', 'spinster.xyz',
return ('fedilist.com', 'gab.com', 'gabfed.com', 'spinster.xyz',
'kiwifarms.cc', 'djitter.com')