From 024220e58acd6d1c74c93010b86da6f709655a5f Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 6 Jul 2024 23:41:53 +0800 Subject: [PATCH] add more fine-grained hide options for https://github.com/rustdesk/rustdesk-server-pro/issues/276 --- .../desktop/pages/desktop_setting_page.dart | 24 +++++++++++++------ libs/hbb_common/src/config.rs | 4 ++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 7c955e6fb..8ff417585 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -173,10 +173,15 @@ class _DesktopSettingPageState extends State } List _children() { + final hideSecurity = + bind.mainGetLocalOption(key: "hide-security-settings") == 'Y'; + final hideNetwork = + bind.mainGetLocalOption(key: "hide-network-settings") == 'Y'; final children = [ _General(), - if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) _Safety(), - if (!bind.isDisableSettings()) _Network(), + if (!bind.isOutgoingOnly() && !bind.isDisableSettings() && !hideSecurity) + _Safety(), + if (!bind.isDisableSettings() && !hideNetwork) _Network(), if (!bind.isIncomingOnly()) _Display(), if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled()) _Plugin(), @@ -1266,6 +1271,10 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin { super.build(context); bool enabled = !locked; final scrollController = ScrollController(); + final hideServer = + bind.mainGetLocalOption(key: "hide-server-settings") == 'Y'; + final hideProxy = + bind.mainGetLocalOption(key: "hide-proxy-settings") == 'Y'; return DesktopScrollWrapper( scrollController: scrollController, child: ListView( @@ -1279,11 +1288,12 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin { AbsorbPointer( absorbing: locked, child: Column(children: [ - server(enabled), - _Card(title: 'Proxy', children: [ - _Button('Socks5/Http(s) Proxy', changeSocks5Proxy, - enabled: enabled), - ]), + if (!hideServer) server(enabled), + if (!hideProxy) + _Card(title: 'Proxy', children: [ + _Button('Socks5/Http(s) Proxy', changeSocks5Proxy, + enabled: enabled), + ]), ]), ), ]).marginOnly(bottom: _kListViewBottomMargin)); diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 88a24d1b3..0778a487d 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -2189,6 +2189,10 @@ pub mod keys { OPTION_PRE_ELEVATE_SERVICE, OPTION_DISPLAY_NAME, "remove-preset-password-warning", + "hide-security-settings", + "hide-network-settings", + "hide-server-settings", + "hide-proxy-settings", ]; // DEFAULT_SETTINGS, OVERWRITE_SETTINGS pub const KEYS_SETTINGS: &[&str] = &[