An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
move option `video-save-directory` and `allow-auto-record-outgoing` to local (#9715)
21pages6159449eba86
diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dartindex 766c160e0..15cf2173b 100644--- a/flutter/lib/desktop/pages/desktop_setting_page.dart+++ b/flutter/lib/desktop/pages/desktop_setting_page.dart@@ -580,7 +580,8 @@ class _GeneralState extends State<_General> {kOptionAllowAutoRecordIncoming),if (!bind.isIncomingOnly())_OptionCheckBox(context, 'Automatically record outgoing sessions',- kOptionAllowAutoRecordOutgoing),+ kOptionAllowAutoRecordOutgoing,+ isServer: false),if (showRootDir && !bind.isOutgoingOnly())Row(children: [@@ -635,7 +636,7 @@ class _GeneralState extends State<_General> {await FilePicker.platform.getDirectoryPath(initialDirectory: initialDirectory);if (selectedDirectory != null) {- await bind.mainSetOption(+ await bind.mainSetLocalOption(key: kOptionVideoSaveDirectory,value: selectedDirectory);setState(() {});diff --git a/flutter/lib/mobile/pages/settings_page.dart b/flutter/lib/mobile/pages/settings_page.dartindex e70ee5b35..eb3865933 100644--- a/flutter/lib/mobile/pages/settings_page.dart+++ b/flutter/lib/mobile/pages/settings_page.dart@@ -106,7 +106,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {_autoRecordIncomingSession = option2bool(kOptionAllowAutoRecordIncoming,bind.mainGetOptionSync(key: kOptionAllowAutoRecordIncoming));_autoRecordOutgoingSession = option2bool(kOptionAllowAutoRecordOutgoing,- bind.mainGetOptionSync(key: kOptionAllowAutoRecordOutgoing));+ bind.mainGetLocalOption(key: kOptionAllowAutoRecordOutgoing));_localIP = bind.mainGetOptionSync(key: 'local-ip-addr');_directAccessPort = bind.mainGetOptionSync(key: kOptionDirectAccessPort);_allowAutoDisconnect = option2bool(kOptionAllowAutoDisconnect,@@ -711,13 +711,13 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {onToggle: isOptionFixed(kOptionAllowAutoRecordOutgoing)? null: (v) async {- await bind.mainSetOption(+ await bind.mainSetLocalOption(key: kOptionAllowAutoRecordOutgoing,value: bool2option(kOptionAllowAutoRecordOutgoing, v));final newValue = option2bool(kOptionAllowAutoRecordOutgoing,- await bind.mainGetOption(+ bind.mainGetLocalOption(key: kOptionAllowAutoRecordOutgoing));setState(() {_autoRecordOutgoingSession = newValue;diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rsindex 94f4ec9d9..0cb370cd8 100644--- a/libs/hbb_common/src/config.rs+++ b/libs/hbb_common/src/config.rs@@ -1562,6 +1562,21 @@ impl LocalConfig {.unwrap_or_default()}+ // Usually get_option should be used.+ pub fn get_option_from_file(k: &str) -> String {+ get_or(+ &OVERWRITE_LOCAL_SETTINGS,+ &Self::load().options,+ &DEFAULT_LOCAL_SETTINGS,+ k,+ )+ .unwrap_or_default()+ }++ pub fn get_bool_option(k: &str) -> bool {+ option2bool(k, &Self::get_option(k))+ }+pub fn set_option(k: String, v: String) {if !is_option_can_save(&OVERWRITE_LOCAL_SETTINGS, &k, &DEFAULT_LOCAL_SETTINGS, &v) {return;@@ -2326,6 +2341,8 @@ pub mod keys {OPTION_DISABLE_GROUP_PANEL,OPTION_PRE_ELEVATE_SERVICE,OPTION_ALLOW_REMOTE_CM_MODIFICATION,+ OPTION_ALLOW_AUTO_RECORD_OUTGOING,+ OPTION_VIDEO_SAVE_DIRECTORY,];// DEFAULT_SETTINGS, OVERWRITE_SETTINGSpub const KEYS_SETTINGS: &[&str] = &[@@ -2347,8 +2364,6 @@ pub mod keys {OPTION_AUTO_DISCONNECT_TIMEOUT,OPTION_ALLOW_ONLY_CONN_WINDOW_OPEN,OPTION_ALLOW_AUTO_RECORD_INCOMING,- OPTION_ALLOW_AUTO_RECORD_OUTGOING,- OPTION_VIDEO_SAVE_DIRECTORY,OPTION_ENABLE_ABR,OPTION_ALLOW_REMOVE_WALLPAPER,OPTION_ALLOW_ALWAYS_SOFTWARE_RENDER,diff --git a/src/client.rs b/src/client.rsindex a1b2b83d4..4b86d189b 100644--- a/src/client.rs+++ b/src/client.rs@@ -1442,7 +1442,7 @@ impl LoginConfigHandler {self.adapter_luid = adapter_luid;self.selected_windows_session_id = None;self.shared_password = shared_password;- self.record = Config::get_bool_option(OPTION_ALLOW_AUTO_RECORD_OUTGOING);+ self.record = LocalConfig::get_bool_option(OPTION_ALLOW_AUTO_RECORD_OUTGOING);}/// Check if the client should auto login.diff --git a/src/ipc.rs b/src/ipc.rsindex c7243d821..81693a735 100644--- a/src/ipc.rs+++ b/src/ipc.rs@@ -890,7 +890,7 @@ pub async fn set_data(data: &Data) -> ResultType<()> {set_data_async(data).await}-pub async fn set_data_async(data: &Data) -> ResultType<()> {+async fn set_data_async(data: &Data) -> ResultType<()> {let mut c = connect(1000, "").await?;c.send(data).await?;Ok(())diff --git a/src/ui/index.tis b/src/ui/index.tisindex daf2c1020..3ae54637f 100644--- a/src/ui/index.tis+++ b/src/ui/index.tis@@ -253,7 +253,7 @@ class Enhancements: Reactor.Component {var root_dir = show_root_dir ? handler.video_save_directory(true) : "";var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {};var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {};- var ts2 = handler.get_option("allow-auto-record-outgoing") == 'Y' ? { checked: true } : {};+ var ts2 = handler.get_local_option("allow-auto-record-outgoing") == 'Y' ? { checked: true } : {};msgbox("custom-recording", translate('Recording'),<div .form><div><button|checkbox(enable_record_session) {ts0}>{translate('Enable recording session')}</button></div>@@ -269,8 +269,8 @@ class Enhancements: Reactor.Component {if (!res) return;handler.set_option("enable-record-session", res.enable_record_session ? '' : 'N');handler.set_option("allow-auto-record-incoming", res.auto_record_incoming ? 'Y' : '');- handler.set_option("allow-auto-record-outgoing", res.auto_record_outgoing ? 'Y' : '');- handler.set_option("video-save-directory", $(#folderPath).text);+ handler.set_local_option("allow-auto-record-outgoing", res.auto_record_outgoing ? 'Y' : '');+ handler.set_local_option("video-save-directory", $(#folderPath).text);});}this.toggleMenuState();diff --git a/src/ui_interface.rs b/src/ui_interface.rsindex e9f2875be..bab54c79a 100644--- a/src/ui_interface.rs+++ b/src/ui_interface.rs@@ -212,7 +212,7 @@ pub fn get_builtin_option(key: &str) -> String {#[inline]pub fn set_local_option(key: String, value: String) {- LocalConfig::set_option(key, value);+ LocalConfig::set_option(key.clone(), value.clone());}#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]@@ -844,7 +844,11 @@ pub fn video_save_directory(root: bool) -> String {return dir.to_string_lossy().to_string();}}- let dir = Config::get_option("video-save-directory");+ // Get directory from config file otherwise --server will use the old value from global var.+ #[cfg(any(target_os = "linux", target_os = "macos"))]+ let dir = LocalConfig::get_option_from_file(OPTION_VIDEO_SAVE_DIRECTORY);+ #[cfg(not(any(target_os = "linux", target_os = "macos")))]+ let dir = LocalConfig::get_option(OPTION_VIDEO_SAVE_DIRECTORY);if !dir.is_empty() {return dir;}