mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-28 07:47:10 +00:00
perf: 修改 agent 判断
This commit is contained in:
parent
4ec7a4a118
commit
ee926cfa42
@ -86,12 +86,11 @@ def get_request_os(request):
|
|||||||
"""获取请求的操作系统"""
|
"""获取请求的操作系统"""
|
||||||
agent = request.META.get('HTTP_USER_AGENT', '').lower()
|
agent = request.META.get('HTTP_USER_AGENT', '').lower()
|
||||||
|
|
||||||
if agent is None:
|
if 'windows' in agent:
|
||||||
return 'unknown'
|
|
||||||
if 'windows' in agent.lower():
|
|
||||||
return 'windows'
|
return 'windows'
|
||||||
if 'mac' in agent.lower():
|
elif 'mac' in agent:
|
||||||
return 'mac'
|
return 'mac'
|
||||||
if 'linux' in agent.lower():
|
elif 'linux' in agent:
|
||||||
return 'linux'
|
return 'linux'
|
||||||
|
else:
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
|
Loading…
Reference in New Issue
Block a user