From a2eb431015b08d35fb2d8637391a4660ab576467 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 8 Jun 2021 12:45:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/api/connection_token.py | 12 ++++++++---- apps/authentication/serializers.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index ef908ed71..7add2d804 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -99,8 +99,8 @@ class UserConnectionTokenViewSet(RootOrgViewMixin, SerializerMixin2, GenericView 'full address:s': '', 'username:s': '', 'screen mode id:i': '0', - 'desktopwidth:i': '1280', - 'desktopheight:i': '800', + # 'desktopwidth:i': '1280', + # 'desktopheight:i': '800', 'use multimon:i': '1', 'session bpp:i': '32', 'audiomode:i': '0', @@ -120,6 +120,7 @@ class UserConnectionTokenViewSet(RootOrgViewMixin, SerializerMixin2, GenericView 'autoreconnection enabled:i': '1', 'bookmarktype:i': '3', 'use redirection server name:i': '0', + 'smart sizing:i': '0' # 'alternate shell:s:': '||MySQLWorkbench', # 'remoteapplicationname:s': 'Firefox', # 'remoteapplicationcmdline:s': '', @@ -145,8 +146,11 @@ class UserConnectionTokenViewSet(RootOrgViewMixin, SerializerMixin2, GenericView address = request.get_host().split(':')[0] + ':3389' options['full address:s'] = address options['username:s'] = '{}|{}'.format(user.username, token) - options['desktopwidth:i'] = width - options['desktopheight:i'] = height + if width and height: + options['desktopwidth:i'] = width + options['desktopheight:i'] = height + else: + options['smart sizing:i'] = '1' data = '' for k, v in options.items(): data += f'{k}:{v}\n' diff --git a/apps/authentication/serializers.py b/apps/authentication/serializers.py index 9265755d6..11381c4cb 100644 --- a/apps/authentication/serializers.py +++ b/apps/authentication/serializers.py @@ -199,5 +199,5 @@ class ConnectionTokenSecretSerializer(serializers.Serializer): class RDPFileSerializer(ConnectionTokenSerializer): - width = serializers.IntegerField(default=1600) - height = serializers.IntegerField(default=900) + width = serializers.IntegerField(allow_null=True, max_value=3112, min_value=100, required=False) + height = serializers.IntegerField(allow_null=True, max_value=4096, min_value=100, required=False)