fix: custom client, options, option2bool() (#8302)

* fix: custom client, options, option2bool()

Signed-off-by: fufesou <linlong1266@gmail.com>

* format

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2024-06-10 00:11:59 +08:00
committed by GitHub
parent 78d7bfac01
commit 32ab56f864
8 changed files with 45 additions and 7 deletions

View File

@@ -83,7 +83,10 @@ pub fn core_main() -> Option<Vec<String>> {
#[cfg(feature = "flutter")]
{
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "1");
if !config::Config::get_option("allow-always-software-render").is_empty() {
if config::option2bool(
"allow-always-software-render",
&config::Config::get_option("allow-always-software-render"),
) {
std::env::set_var(k, v);
} else {
std::env::remove_var(k);

View File

@@ -34,7 +34,11 @@ pub(super) fn start_listening() -> ResultType<()> {
if let Ok(msg_in) = Message::parse_from_bytes(&buf[0..len]) {
match msg_in.union {
Some(rendezvous_message::Union::PeerDiscovery(p)) => {
if p.cmd == "ping" && Config::get_option("enable-lan-discovery").is_empty()
if p.cmd == "ping"
&& config::option2bool(
"enable-lan-discovery",
&Config::get_option("enable-lan-discovery"),
)
{
if let Some(self_addr) = get_ipaddr_by_peer(&addr) {
let mut msg_out = Message::new();

View File

@@ -1366,7 +1366,10 @@ impl Connection {
fn on_remote_authorized(&self) {
self.update_codec_on_login();
#[cfg(any(target_os = "windows", target_os = "linux"))]
if !Config::get_option("allow-remove-wallpaper").is_empty() {
if config::option2bool(
"allow-remove-wallpaper",
&Config::get_option("allow-remove-wallpaper"),
) {
// multi connections set once
let mut wallpaper = WALLPAPER_REMOVER.lock().unwrap();
if wallpaper.is_none() {
@@ -1555,7 +1558,10 @@ impl Connection {
return false;
}
}
return Config::get_option(enable_prefix_option).is_empty();
config::option2bool(
enable_prefix_option,
&Config::get_option(enable_prefix_option),
)
}
fn update_codec_on_login(&self) {

View File

@@ -37,6 +37,7 @@ use crate::{
};
use hbb_common::{
anyhow::anyhow,
config,
tokio::sync::{
mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender},
Mutex as TokioMutex,
@@ -411,7 +412,10 @@ fn run(vs: VideoService) -> ResultType<()> {
video_qos.refresh(None);
let mut spf;
let mut quality = video_qos.quality();
let record_incoming = !Config::get_option("allow-auto-record-incoming").is_empty();
let record_incoming = config::option2bool(
"allow-auto-record-incoming",
&Config::get_option("allow-auto-record-incoming"),
);
let client_record = video_qos.record();
drop(video_qos);
let (mut encoder, encoder_cfg, codec_format, use_i444, recorder) = match setup_encoder(

View File

@@ -1208,7 +1208,7 @@ function self.onMouse(evt) {
}
function check_if_overlay() {
if (!handler.get_option('allow-remote-config-modification')) {
if (handler.get_option('allow-remote-config-modification') == 'Y') {
var time0 = getTime();
handler.check_mouse_time();
self.timer(120ms, function() {