mirror of https://github.com/jumpserver/jumpserver
[Update] 修复录像回放 Bug (#3506)
parent
4944ac8e75
commit
df52240227
|
@ -105,9 +105,9 @@ class SessionReplayViewSet(viewsets.ViewSet):
|
||||||
data['src'] = url
|
data['src'] = url
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
# 去定义的外部storage查找
|
# 去 Session 相关的 Terminal 中关联的存储中查找
|
||||||
configs = settings.TERMINAL_REPLAY_STORAGE
|
replay_storage = session.terminal.get_replay_storage()
|
||||||
configs = {k: v for k, v in configs.items() if v['TYPE'] != 'server'}
|
configs = {replay_storage.name: replay_storage.config}
|
||||||
if not configs:
|
if not configs:
|
||||||
return HttpResponseNotFound()
|
return HttpResponseNotFound()
|
||||||
|
|
||||||
|
|
|
@ -58,20 +58,36 @@ class Terminal(models.Model):
|
||||||
self.user.is_active = active
|
self.user.is_active = active
|
||||||
self.user.save()
|
self.user.save()
|
||||||
|
|
||||||
|
def get_command_storage(self):
|
||||||
|
storage = CommandStorage.objects.filter(name=self.command_storage).first()
|
||||||
|
return storage
|
||||||
|
|
||||||
def get_command_storage_config(self):
|
def get_command_storage_config(self):
|
||||||
s = CommandStorage.objects.filter(name=self.command_storage).first()
|
s = self.get_command_storage()
|
||||||
if s:
|
if s:
|
||||||
config = s.config
|
config = s.config
|
||||||
else:
|
else:
|
||||||
config = settings.DEFAULT_TERMINAL_COMMAND_STORAGE
|
config = settings.DEFAULT_TERMINAL_COMMAND_STORAGE
|
||||||
|
return config
|
||||||
|
|
||||||
|
def get_command_storage_setting(self):
|
||||||
|
config = self.get_command_storage_config()
|
||||||
return {"TERMINAL_COMMAND_STORAGE": config}
|
return {"TERMINAL_COMMAND_STORAGE": config}
|
||||||
|
|
||||||
|
def get_replay_storage(self):
|
||||||
|
storage = ReplayStorage.objects.filter(name=self.replay_storage).first()
|
||||||
|
return storage
|
||||||
|
|
||||||
def get_replay_storage_config(self):
|
def get_replay_storage_config(self):
|
||||||
s = ReplayStorage.objects.filter(name=self.replay_storage).first()
|
s = self.get_replay_storage()
|
||||||
if s:
|
if s:
|
||||||
config = s.config
|
config = s.config
|
||||||
else:
|
else:
|
||||||
config = settings.DEFAULT_TERMINAL_REPLAY_STORAGE
|
config = settings.DEFAULT_TERMINAL_REPLAY_STORAGE
|
||||||
|
return config
|
||||||
|
|
||||||
|
def get_replay_storage_setting(self):
|
||||||
|
config = self.get_replay_storage_config()
|
||||||
return {"TERMINAL_REPLAY_STORAGE": config}
|
return {"TERMINAL_REPLAY_STORAGE": config}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -81,8 +97,8 @@ class Terminal(models.Model):
|
||||||
if not k.startswith('TERMINAL'):
|
if not k.startswith('TERMINAL'):
|
||||||
continue
|
continue
|
||||||
configs[k] = getattr(settings, k)
|
configs[k] = getattr(settings, k)
|
||||||
configs.update(self.get_command_storage_config())
|
configs.update(self.get_command_storage_setting())
|
||||||
configs.update(self.get_replay_storage_config())
|
configs.update(self.get_replay_storage_setting())
|
||||||
configs.update({
|
configs.update({
|
||||||
'SECURITY_MAX_IDLE_TIME': settings.SECURITY_MAX_IDLE_TIME
|
'SECURITY_MAX_IDLE_TIME': settings.SECURITY_MAX_IDLE_TIME
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue