From b28ce9de7a9d105ec076fa02309e277137104e6c Mon Sep 17 00:00:00 2001 From: xinwen Date: Tue, 9 Nov 2021 17:10:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20xrdp=20session=20bpp=20=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/api/connection_token.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index 842011a94..2ff4fa71c 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -4,6 +4,7 @@ import urllib.parse import json import base64 from typing import Callable +import os from django.conf import settings from django.core.cache import cache @@ -50,6 +51,10 @@ class ClientProtocolMixin: user = self.request.user return asset, application, system_user, user + @staticmethod + def parse_env_bool(env_key, env_default, true_value, false_value): + return true_value if is_true(os.getenv(env_key, env_default)) else false_value + def get_rdp_file_content(self, serializer): options = { 'full address:s': '', @@ -112,6 +117,10 @@ class ClientProtocolMixin: options['desktopheight:i'] = height else: options['smart sizing:i'] = '1' + + options['session bpp:i'] = os.getenv('JUMPSERVER_COLOR_DEPTH', '32') + options['audiomode:i'] = self.parse_env_bool('JUMPSERVER_DISABLE_AUDIO', 'false', '2', '0') + content = '' for k, v in options.items(): content += f'{k}:{v}\n'