mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Allowing oauth users to not bother having a user agent.
This commit is contained in:
parent
5b543377a8
commit
4cb75f782d
2 changed files with 3 additions and 3 deletions
|
@ -183,12 +183,14 @@ BANNED_USER_AGENTS = (
|
||||||
'feed reader-background',
|
'feed reader-background',
|
||||||
'missing',
|
'missing',
|
||||||
)
|
)
|
||||||
|
|
||||||
class UserAgentBanMiddleware:
|
class UserAgentBanMiddleware:
|
||||||
def process_request(self, request):
|
def process_request(self, request):
|
||||||
user_agent = request.environ.get('HTTP_USER_AGENT', 'missing').lower()
|
user_agent = request.environ.get('HTTP_USER_AGENT', 'missing').lower()
|
||||||
|
|
||||||
if 'profile' in request.path: return
|
if 'profile' in request.path: return
|
||||||
if 'haproxy' in request.path: return
|
if 'haproxy' in request.path: return
|
||||||
|
if 'account' in request.path: return
|
||||||
if getattr(settings, 'TEST_DEBUG'): return
|
if getattr(settings, 'TEST_DEBUG'): return
|
||||||
|
|
||||||
if any(ua in user_agent for ua in BANNED_USER_AGENTS):
|
if any(ua in user_agent for ua in BANNED_USER_AGENTS):
|
||||||
|
@ -197,7 +199,6 @@ class UserAgentBanMiddleware:
|
||||||
'code': -1
|
'code': -1
|
||||||
}
|
}
|
||||||
logging.user(request, "~FB~SN~BBBanned UA: ~SB%s" % (user_agent))
|
logging.user(request, "~FB~SN~BBBanned UA: ~SB%s" % (user_agent))
|
||||||
|
|
||||||
return HttpResponse(json.encode(data), status=403, mimetype='text/json')
|
|
||||||
|
|
||||||
|
return HttpResponse(json.encode(data), status=403, mimetype='text/json')
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,6 @@ OAUTH2_PROVIDER = {
|
||||||
'write': 'Create new saved stories, shared stories, and subscriptions.',
|
'write': 'Create new saved stories, shared stories, and subscriptions.',
|
||||||
'ifttt': 'Pair your NewsBlur account with other IFTTT channels.',
|
'ifttt': 'Pair your NewsBlur account with other IFTTT channels.',
|
||||||
},
|
},
|
||||||
|
|
||||||
'CLIENT_ID_GENERATOR_CLASS': 'oauth2_provider.generators.ClientIdGenerator',
|
'CLIENT_ID_GENERATOR_CLASS': 'oauth2_provider.generators.ClientIdGenerator',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue