fix: custom client, option to bool (#8303)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2024-06-10 11:01:39 +08:00
committed by GitHub
parent 32ab56f864
commit 9ab5512bfa
8 changed files with 32 additions and 30 deletions

View File

@@ -1286,7 +1286,9 @@ impl LoginConfigHandler {
self.session_id = sid;
self.supported_encoding = Default::default();
self.restarting_remote_device = false;
self.force_relay = !self.get_option("force-always-relay").is_empty() || force_relay;
self.force_relay =
config::option2bool("force-always-relay", &self.get_option("force-always-relay"))
|| force_relay;
if let Some((real_id, server, key)) = &self.other_server {
let other_server_key = self.get_option("other-server-key");
if !other_server_key.is_empty() && key.is_empty() {
@@ -1451,6 +1453,10 @@ impl LoginConfigHandler {
/// # Arguments
///
/// * `name` - The name of the option to toggle.
///
// It's Ok to check the option empty in this function.
// `toggle_option()` is only called in a session.
// Custom client advanced settings will not affact this function.
pub fn toggle_option(&mut self, name: String) -> Option<Message> {
let mut option = OptionMessage::default();
let mut config = self.load_config();
@@ -1707,6 +1713,10 @@ impl LoginConfigHandler {
/// # Arguments
///
/// * `name` - The name of the toggle option.
///
// It's Ok to check the option empty in this function.
// `get_toggle_option()` is only called in a session.
// Custom client advanced settings will not affact this function.
pub fn get_toggle_option(&self, name: &str) -> bool {
if name == "show-remote-cursor" {
self.config.show_remote_cursor.v