more on custom client

This commit is contained in:
rustdesk
2024-03-12 21:47:29 +08:00
parent f644053811
commit fc875f7ad6
13 changed files with 159 additions and 47 deletions

View File

@@ -1477,6 +1477,11 @@ impl ClipboardContext {
}
pub fn load_custom_client() {
#[cfg(debug_assertions)]
if let Ok(data) = std::fs::read_to_string("./custom.txt") {
read_custom_client(data.trim());
return;
}
let Ok(cmd) = std::env::current_exe() else {
return;
};
@@ -1488,7 +1493,7 @@ pub fn load_custom_client() {
log::error!("Failed to read custom client config");
return;
};
read_custom_client(&data);
read_custom_client(&data.trim());
}
}
@@ -1512,7 +1517,13 @@ pub fn read_custom_client(config: &str) {
log::error!("Failed to parse custom client config");
return;
};
if let Some(default_settings) = data.remove("default_settings") {
if let Some(app_name) = data.remove("app-name") {
if let Some(app_name) = app_name.as_str() {
*config::APP_NAME.write().unwrap() = app_name.to_owned();
}
}
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 {
@@ -1537,7 +1548,7 @@ pub fn read_custom_client(config: &str) {
}
}
}
if let Some(overwrite_settings) = data.remove("overwrite_settings") {
if let Some(overwrite_settings) = data.remove("override-settings") {
if let Some(overwrite_settings) = overwrite_settings.as_object() {
for (k, v) in overwrite_settings {
let Some(v) = v.as_str() else {