mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Banning missing user agents.
This commit is contained in:
parent
0c38f5d14d
commit
6fd63489c1
1 changed files with 2 additions and 0 deletions
|
@ -180,10 +180,12 @@ class TimingMiddleware:
|
|||
BANNED_USER_AGENTS = (
|
||||
'feed reader-background',
|
||||
'feed reader-windows',
|
||||
'missing',
|
||||
)
|
||||
class UserAgentBanMiddleware:
|
||||
def process_request(self, request):
|
||||
user_agent = request.environ.get('HTTP_USER_AGENT', 'missing').lower()
|
||||
|
||||
if any(ua in user_agent for ua in BANNED_USER_AGENTS):
|
||||
data = {
|
||||
'error': 'User agent banned: %s' % user_agent,
|
||||
|
|
Loading…
Add table
Reference in a new issue