move option video-save-directory and allow-auto-record-outgoing to local (#9715)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-10-22 08:24:52 +08:00
committed by GitHub
parent 6088920f8d
commit 6159449eba
7 changed files with 34 additions and 14 deletions

View File

@@ -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.

View File

@@ -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(())

View File

@@ -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();

View File

@@ -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;
}