From f486c843bf665aae648e43b6da99ea6107cff8d8 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:36:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E6=8B=89=E8=B5=B7?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=AE=A2=E6=88=B7=E7=AB=AF=20(#10865)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: 拉起本地客户端应用接口提供更多数据 * fix: rdp客户端拉起后窗口标题中文乱码 * perf: ssh客户端连接选项显示优化 * feat: 增加本地sftp客户端选项 * perf: 合并支持sftp协议 * perf: sftp与ssh使用相同端口 --------- Co-authored-by: halo --- apps/authentication/api/connection_token.py | 15 ++++++++++----- apps/terminal/models/component/endpoint.py | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index a04c2218a..e805069d2 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -148,16 +148,25 @@ class RDPFileClientProtocolURLMixin: if connect_method_dict is None: raise ValueError('Connect method not support: {}'.format(connect_method_name)) + endpoint = self.get_smart_endpoint( + protocol=connect_method_dict['endpoint_protocol'], + asset=token.asset + ) data = { 'id': str(token.id), - 'value': token.value, + 'name': f'{endpoint.host}-{str(token.id)[:18]}', 'protocol': token.protocol, + 'host': endpoint.host, + 'port': endpoint.get_port(token.asset, token.protocol), + 'username': f'JMS-{str(token.id)}', + 'value': token.value, 'command': '', 'file': {} } if connect_method_name == NativeClient.mstsc or connect_method_dict['type'] == 'applet': filename, content = self.get_rdp_file_info(token) + filename = urllib.parse.unquote(filename) data.update({ 'protocol': 'rdp', 'file': { @@ -166,10 +175,6 @@ class RDPFileClientProtocolURLMixin: } }) else: - endpoint = self.get_smart_endpoint( - protocol=connect_method_dict['endpoint_protocol'], - asset=token.asset - ) cmd = NativeClient.get_launch_command(connect_method_name, token, endpoint) data.update({'command': cmd}) return data diff --git a/apps/terminal/models/component/endpoint.py b/apps/terminal/models/component/endpoint.py index 8daf75a57..88d2f6c8f 100644 --- a/apps/terminal/models/component/endpoint.py +++ b/apps/terminal/models/component/endpoint.py @@ -41,6 +41,8 @@ class Endpoint(JMSBaseModel): protocol == Protocol.oracle: port = db_port_manager.get_port_by_db(target_instance) else: + if protocol == Protocol.sftp: + protocol = Protocol.ssh port = getattr(self, f'{protocol}_port', 0) return port