fix more bool options (#8809)

* fix more bool options
* hide sort ab tags because it's already sorted

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-07-24 17:20:58 +08:00
committed by GitHub
parent 79a1f888d6
commit c04f460bbd
8 changed files with 29 additions and 23 deletions

View File

@@ -12,7 +12,10 @@ use uuid::Uuid;
use hbb_common::{
allow_err,
anyhow::{self, bail},
config::{self, Config, CONNECT_TIMEOUT, READ_TIMEOUT, REG_INTERVAL, RENDEZVOUS_PORT},
config::{
self, keys::*, option2bool, Config, CONNECT_TIMEOUT, READ_TIMEOUT, REG_INTERVAL,
RENDEZVOUS_PORT,
},
futures::future::join_all,
log,
protobuf::Message as _,
@@ -637,8 +640,10 @@ async fn direct_server(server: ServerPtr) {
let mut listener = None;
let mut port = 0;
loop {
let disabled = Config::get_option("direct-server").is_empty()
|| !Config::get_option("stop-service").is_empty();
let disabled = !option2bool(
OPTION_DIRECT_SERVER,
&Config::get_option(OPTION_DIRECT_SERVER),
) || option2bool("stop-service", &Config::get_option("stop-service"));
if !disabled && listener.is_none() {
port = get_direct_port();
match hbb_common::tcp::listen_any(port as _).await {

View File

@@ -1149,7 +1149,7 @@ function showSettings() {
function checkConnectStatus() {
handler.check_mouse_time(); // trigger connection status updater
self.timer(1s, function() {
var tmp = !!handler.get_option("stop-service");
var tmp = handler.get_option("stop-service") == "Y";
if (tmp != service_stopped) {
service_stopped = tmp;
app.update();

View File

@@ -21,7 +21,7 @@ use clipboard::ContextSend;
use hbb_common::tokio::sync::mpsc::unbounded_channel;
use hbb_common::{
allow_err,
config::Config,
config::{keys::*, option2bool, Config},
fs::is_write_need_confirmation,
fs::{self, get_string, new_send_confirm, DigestCheckResult},
log,
@@ -583,9 +583,10 @@ pub async fn start_ipc<T: InvokeUiCM>(cm: ConnectionManager<T>) {
feature = "unix-file-copy-paste"
),
))]
ContextSend::enable(
Config::get_option(hbb_common::config::keys::OPTION_ENABLE_FILE_TRANSFER).is_empty(),
);
ContextSend::enable(option2bool(
OPTION_ENABLE_FILE_TRANSFER,
&Config::get_option(OPTION_ENABLE_FILE_TRANSFER),
));
match ipc::new_listener("_cm").await {
Ok(mut incoming) => {

View File

@@ -3,7 +3,10 @@ use hbb_common::password_security;
use hbb_common::{
allow_err,
bytes::Bytes,
config::{self, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT, RENDEZVOUS_PORT},
config::{
self, keys::*, option2bool, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT,
RENDEZVOUS_PORT,
},
directories_next,
futures::future::join_all,
log,
@@ -1156,9 +1159,9 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
)
))]
{
let b = OPTIONS.lock().unwrap().get(config::keys::OPTION_ENABLE_FILE_TRANSFER).map(|x| x.to_string()).unwrap_or_default();
let b = OPTIONS.lock().unwrap().get(OPTION_ENABLE_FILE_TRANSFER).map(|x| x.to_string()).unwrap_or_default();
if b != enable_file_transfer {
clipboard::ContextSend::enable(b.is_empty());
clipboard::ContextSend::enable(option2bool(OPTION_ENABLE_FILE_TRANSFER, &b));
enable_file_transfer = b;
}
}