mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-26 06:52:53 +00:00
Merge pull request #9713 from jumpserver/pr@dev@perf_agent_check
perf: 修改 agent 判断
This commit is contained in:
commit
68ea8ef1b7
@ -85,13 +85,12 @@ def bulk_create_with_signal(cls: models.Model, items, **kwargs):
|
|||||||
def get_request_os(request):
|
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'
|
||||||
return 'unknown'
|
else:
|
||||||
|
return 'unknown'
|
||||||
|
Loading…
Reference in New Issue
Block a user