Merge pull request #3438 from fufesou/fix/config_default_key_err

default config filed
This commit is contained in:
RustDesk 2023-03-01 12:57:16 +08:00 committed by GitHub
commit 846948985d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View File

@ -0,0 +1,5 @@
extern crate hbb_common;
fn main() {
println!("{:?}", hbb_common::config::PeerConfig::load("455058072"));
}

View File

@ -110,10 +110,10 @@ macro_rules! serde_field_string {
}
macro_rules! serde_field_bool {
($struct_name: ident, $field_name: literal, $func: ident) => {
($struct_name: ident, $field_name: literal, $func: ident, $default: literal) => {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct $struct_name {
#[serde(rename = $field_name)]
#[serde(default = $default, rename = $field_name)]
pub v: bool,
}
impl Default for $struct_name {
@ -1037,32 +1037,37 @@ impl PeerConfig {
serde_field_bool!(
ShowRemoteCursor,
"show_remote_cursor",
default_show_remote_cursor
default_show_remote_cursor,
"ShowRemoteCursor::default_show_remote_cursor"
);
serde_field_bool!(
ShowQualityMonitor,
"show_quality_monitor",
default_show_quality_monitor
default_show_quality_monitor,
"ShowQualityMonitor::default_show_quality_monitor"
);
serde_field_bool!(DisableAudio, "disable_audio", default_disable_audio);
serde_field_bool!(DisableAudio, "disable_audio", default_disable_audio, "DisableAudio::default_disable_audio");
serde_field_bool!(
EnableFileTransfer,
"enable_file_transfer",
default_enable_file_transfer
default_enable_file_transfer,
"EnableFileTransfer::default_enable_file_transfer"
);
serde_field_bool!(
DisableClipboard,
"disable_clipboard",
default_disable_clipboard
default_disable_clipboard,
"DisableClipboard::default_disable_clipboard"
);
serde_field_bool!(
LockAfterSessionEnd,
"lock_after_session_end",
default_lock_after_session_end
default_lock_after_session_end,
"LockAfterSessionEnd::default_lock_after_session_end"
);
serde_field_bool!(PrivacyMode, "privacy_mode", default_privacy_mode);
serde_field_bool!(PrivacyMode, "privacy_mode", default_privacy_mode, "PrivacyMode::default_privacy_mode");
serde_field_bool!(AllowSwapKey, "allow_swap_key", default_swap_key);
serde_field_bool!(AllowSwapKey, "allow_swap_key", default_allow_swap_key, "AllowSwapKey::default_allow_swap_key");
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct LocalConfig {