mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings Signed-off-by: fufesou <shuanglongchen@yeah.net> * refact: custom client, default options Signed-off-by: fufesou <shuanglongchen@yeah.net> * fix: cargo test Signed-off-by: fufesou <shuanglongchen@yeah.net> * refact: remove prefix $ and unify option keys Signed-off-by: fufesou <shuanglongchen@yeah.net> * refact: custom client, advanced options Signed-off-by: fufesou <shuanglongchen@yeah.net> * debug custom client, advanced settings Signed-off-by: fufesou <shuanglongchen@yeah.net> * custom client, advanced settings. Add filter-transfer to display settings Signed-off-by: fufesou <shuanglongchen@yeah.net> * custom client, advanced settings Signed-off-by: fufesou <shuanglongchen@yeah.net> * fix: custom client, advanced settings, codec Signed-off-by: fufesou <shuanglongchen@yeah.net> * fix: custom client, advanced settings, whitelist Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::HashMap,
|
||||
future::Future,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
task::Poll,
|
||||
@@ -1597,22 +1598,41 @@ pub fn read_custom_client(config: &str) {
|
||||
*config::APP_NAME.write().unwrap() = app_name.to_owned();
|
||||
}
|
||||
}
|
||||
|
||||
let mut map_display_settings = HashMap::new();
|
||||
for s in config::keys::KEYS_DISPLAY_SETTINGS {
|
||||
map_display_settings.insert(s.replace("_", "-"), s);
|
||||
}
|
||||
let mut map_local_settings = HashMap::new();
|
||||
for s in config::keys::KEYS_LOCAL_SETTINGS {
|
||||
map_local_settings.insert(s.replace("_", "-"), s);
|
||||
}
|
||||
let mut map_settings = HashMap::new();
|
||||
for s in config::keys::KEYS_SETTINGS {
|
||||
map_settings.insert(s.replace("_", "-"), s);
|
||||
}
|
||||
|
||||
if let Some(default_settings) = data.remove("default-settings") {
|
||||
if let Some(default_settings) = default_settings.as_object() {
|
||||
for (k, v) in default_settings {
|
||||
let Some(v) = v.as_str() else {
|
||||
continue;
|
||||
};
|
||||
if k.starts_with("$$") {
|
||||
if let Some(k2) = map_display_settings.get(k) {
|
||||
config::DEFAULT_DISPLAY_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k.clone(), v[2..].to_owned());
|
||||
} else if k.starts_with("$") {
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else if let Some(k2) = map_local_settings.get(k) {
|
||||
config::DEFAULT_LOCAL_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k.clone(), v[1..].to_owned());
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else if let Some(k2) = map_settings.get(k) {
|
||||
config::DEFAULT_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else {
|
||||
config::DEFAULT_SETTINGS
|
||||
.write()
|
||||
@@ -1628,16 +1648,21 @@ pub fn read_custom_client(config: &str) {
|
||||
let Some(v) = v.as_str() else {
|
||||
continue;
|
||||
};
|
||||
if k.starts_with("$$") {
|
||||
if let Some(k2) = map_display_settings.get(k) {
|
||||
config::OVERWRITE_DISPLAY_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k.clone(), v[2..].to_owned());
|
||||
} else if k.starts_with("$") {
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else if let Some(k2) = map_local_settings.get(k) {
|
||||
config::OVERWRITE_LOCAL_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k.clone(), v[1..].to_owned());
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else if let Some(k2) = map_settings.get(k) {
|
||||
config::OVERWRITE_SETTINGS
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(k2.to_string(), v.to_owned());
|
||||
} else {
|
||||
config::OVERWRITE_SETTINGS
|
||||
.write()
|
||||
|
||||
@@ -939,7 +939,6 @@ pub fn main_handle_wayland_screencast_restore_token(_key: String, _value: String
|
||||
} else {
|
||||
"".to_owned()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn main_get_input_source() -> SyncReturn<String> {
|
||||
@@ -1194,6 +1193,23 @@ pub fn main_handle_relay_id(id: String) -> String {
|
||||
handle_relay_id(&id).to_owned()
|
||||
}
|
||||
|
||||
pub fn main_is_option_fixed(key: String) -> SyncReturn<bool> {
|
||||
SyncReturn(
|
||||
config::OVERWRITE_DISPLAY_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.contains_key(&key)
|
||||
|| config::OVERWRITE_LOCAL_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.contains_key(&key)
|
||||
|| config::OVERWRITE_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.contains_key(&key),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn main_get_main_display() -> SyncReturn<String> {
|
||||
#[cfg(target_os = "ios")]
|
||||
let display_info = "".to_owned();
|
||||
|
||||
Reference in New Issue
Block a user