mirror of https://gitlab.com/bashrc2/epicyon
Default user agent blocks
parent
d72a27b5cc
commit
8fe8701414
10
daemon.py
10
daemon.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue