perf: 连接 RDP 协议会话时,高级选项支持 session bpp:i 参数配置;默认 32; (#12319)

Co-authored-by: feng <1304903146@qq.com>
pull/12321/head
fit2bot 2023-12-13 15:51:22 +08:00 committed by GitHub
parent 5b51a8231c
commit c4fef5899c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -27,7 +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.const import RDPSmartSize, RDPColorQuality
from users.models import Preference
from ..models import ConnectionToken, date_expired_default
from ..serializers import (
@ -49,7 +49,6 @@ class RDPFileClientProtocolURLMixin:
'full address:s': '',
'username:s': '',
'use multimon:i': '0',
'session bpp:i': '32',
'audiomode:i': '0',
'disable wallpaper:i': '0',
'disable full window drag:i': '0',
@ -100,10 +99,13 @@ class RDPFileClientProtocolURLMixin:
rdp_options['winposstr:s'] = f'0,1,0,0,{width},{height}'
rdp_options['dynamic resolution:i'] = '0'
color_quality = self.request.query_params.get('rdp_color_quality')
color_quality = color_quality if color_quality else os.getenv('JUMPSERVER_COLOR_DEPTH', RDPColorQuality.HIGH)
# 设置其他选项
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['session bpp:i'] = color_quality
rdp_options['audiomode:i'] = self.parse_env_bool('JUMPSERVER_DISABLE_AUDIO', 'false', '2', '0')
rdp_options['smart sizing:i'] = self.request.query_params.get('rdp_smart_size', RDPSmartSize.DISABLE)
# 设置远程应用, 不是 Mstsc
if token.connect_method != NativeClient.mstsc:

View File

@ -38,6 +38,11 @@ class RDPSmartSize(TextChoices):
ENABLE = '1', _('Enable')
class RDPColorQuality(TextChoices):
HIGH = '32', 'High32 bit'
MEDIUM = '16', 'Medium16 bit'
class KeyboardLayout(TextChoices):
EN_US_QWERTY = 'en-us-qwerty', 'US English (Qwerty)'
EN_UK_QWERTY = 'en-gb-qwerty', 'UK English (Qwerty)'

View File

@ -5,7 +5,7 @@ from rest_framework import serializers
from users.const import (
RDPResolution, RDPSmartSize, KeyboardLayout,
RDPClientOption, AppletConnectionMethod
RDPClientOption, AppletConnectionMethod, RDPColorQuality,
)
@ -40,6 +40,10 @@ class GraphicsSerializer(serializers.Serializer):
choices=RDPClientOption.choices, default={RDPClientOption.FULL_SCREEN},
label=_('RDP client option'), required=False
)
rdp_color_quality = serializers.ChoiceField(
choices=RDPColorQuality.choices, default=RDPColorQuality.HIGH,
label=_('RDP color quality'), required=False
)
rdp_smart_size = serializers.ChoiceField(
RDPSmartSize.choices, default=RDPSmartSize.DISABLE,
required=False, label=_('Rdp smart size'),