mirror of https://github.com/jumpserver/jumpserver
perf: 修复录像在线播放问题
parent
13d4177531
commit
ae68241812
|
@ -0,0 +1,14 @@
|
|||
from private_storage.servers import NginxXAccelRedirectServer, DjangoServer
|
||||
|
||||
|
||||
class StaticFileServer(object):
|
||||
|
||||
@staticmethod
|
||||
def serve(private_file):
|
||||
full_path = private_file.full_path
|
||||
# todo: gzip 文件录像 nginx 处理后,浏览器无法正常解析内容
|
||||
# 造成在线播放失败,暂时仅使用 nginx 处理 mp4 录像文件
|
||||
if full_path.endswith('.mp4'):
|
||||
return NginxXAccelRedirectServer.serve(private_file)
|
||||
else:
|
||||
return DjangoServer.serve(private_file)
|
|
@ -319,9 +319,7 @@ MEDIA_ROOT = os.path.join(PROJECT_DIR, 'data', 'media').replace('\\', '/') + '/'
|
|||
PRIVATE_STORAGE_ROOT = MEDIA_ROOT
|
||||
PRIVATE_STORAGE_AUTH_FUNCTION = 'jumpserver.rewriting.storage.permissions.allow_access'
|
||||
PRIVATE_STORAGE_INTERNAL_URL = '/private-media/'
|
||||
PRIVATE_STORAGE_SERVER = 'nginx'
|
||||
if DEBUG_DEV:
|
||||
PRIVATE_STORAGE_SERVER = 'django'
|
||||
PRIVATE_STORAGE_SERVER = 'jumpserver.rewriting.storage.servers.StaticFileServer'
|
||||
|
||||
|
||||
# Use django-bootstrap-form to format template, input max width arg
|
||||
|
|
Loading…
Reference in New Issue