feat: 个人设置 rdp smart size可配置 (#12021)

Co-authored-by: feng <1304903146@qq.com>
pull/12041/head
fit2bot 2023-11-02 18:51:17 +08:00 committed by GitHub
parent 53d8f716eb
commit eee119eba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,7 @@ from perms.models import ActionChoices
from terminal.connect_methods import NativeClient, ConnectMethodUtil
from terminal.models import EndpointRule, Endpoint
from users.const import FileNameConflictResolution
from users.const import RDPSmartSize
from users.models import Preference
from ..models import ConnectionToken, date_expired_default
from ..serializers import (
@ -66,7 +67,6 @@ class RDPFileClientProtocolURLMixin:
'autoreconnection enabled:i': '1',
'bookmarktype:i': '3',
'use redirection server name:i': '0',
'smart sizing:i': '1',
}
# 设置多屏显示
multi_mon = is_true(self.request.query_params.get('multi_mon'))
@ -106,6 +106,7 @@ class RDPFileClientProtocolURLMixin:
rdp_options['dynamic resolution:i'] = '0'
# 设置其他选项
rdp_options['smart sizing:i'] = self.request.query_params.get('rdp_smart_size', RDPSmartSize.DISABLE)
rdp_options['session bpp:i'] = os.getenv('JUMPSERVER_COLOR_DEPTH', '32')
rdp_options['audiomode:i'] = self.parse_env_bool('JUMPSERVER_DISABLE_AUDIO', 'false', '2', '0')

View File

@ -33,6 +33,11 @@ class RDPClientOption(TextChoices):
DRIVES_REDIRECT = 'drives_redirect', _('Drives redirect')
class RDPSmartSize(TextChoices):
DISABLE = '0', _('Disable')
ENABLE = '1', _('Enable')
class KeyboardLayout(TextChoices):
EN_US_QWERTY = 'en-us-qwerty', 'US English (Qwerty)'
EN_UK_QWERTY = 'en-gb-qwerty', 'UK English (Qwerty)'

View File

@ -3,7 +3,10 @@ import json
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from users.const import RDPResolution, KeyboardLayout, RDPClientOption, AppletConnectionMethod
from users.const import (
RDPResolution, RDPSmartSize, KeyboardLayout,
RDPClientOption, AppletConnectionMethod
)
class MultipleChoiceField(serializers.MultipleChoiceField):
@ -37,6 +40,12 @@ class GraphicsSerializer(serializers.Serializer):
choices=RDPClientOption.choices, default={RDPClientOption.FULL_SCREEN},
label=_('RDP client option'), required=False
)
rdp_smart_size = serializers.ChoiceField(
RDPSmartSize.choices, default=RDPSmartSize.DISABLE,
required=False, label=_('Rdp smart size'),
help_text=_('Determines whether the client computer should scale the content on the remote '
'computer to fit the window size of the client computer when the window is resized.')
)
applet_connection_method = serializers.ChoiceField(
AppletConnectionMethod.choices, default=AppletConnectionMethod.WEB,
required=False, label=_('Remote application connection method')