mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-20 19:51:04 +03:00
always block desktop settings page if video connection exists (#10224)
1. Always block desktop settings page if video connection exists, both mouse event and key event are blocked.. 2. Server control page always block key event. Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -266,6 +266,7 @@ pub enum Data {
|
||||
ControlledSessionCount(usize),
|
||||
CmErr(String),
|
||||
CheckHwcodec,
|
||||
#[cfg(feature = "flutter")]
|
||||
VideoConnCount(Option<usize>),
|
||||
// Although the key is not neccessary, it is used to avoid hardcoding the key.
|
||||
WaylandScreencastRestoreToken((String, String)),
|
||||
@@ -455,6 +456,7 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
log::info!("socks updated");
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "flutter")]
|
||||
Data::VideoConnCount(None) => {
|
||||
let n = crate::server::AUTHED_CONNS
|
||||
.lock()
|
||||
|
||||
@@ -47,6 +47,8 @@ pub struct UiStatus {
|
||||
pub mouse_time: i64,
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
pub id: String,
|
||||
#[cfg(feature = "flutter")]
|
||||
pub video_conn_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
@@ -65,14 +67,14 @@ lazy_static::lazy_static! {
|
||||
mouse_time: 0,
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
id: "".to_owned(),
|
||||
#[cfg(feature = "flutter")]
|
||||
video_conn_count: 0,
|
||||
}));
|
||||
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
||||
static ref ASYNC_HTTP_STATUS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(HashMap::new()));
|
||||
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
||||
}
|
||||
|
||||
pub static VIDEO_CONN_COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
lazy_static::lazy_static! {
|
||||
static ref OPTION_SYNCED: Arc<Mutex<bool>> = Default::default();
|
||||
@@ -1144,6 +1146,8 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
let mut key_confirmed = false;
|
||||
let mut rx = rx;
|
||||
let mut mouse_time = 0;
|
||||
#[cfg(feature = "flutter")]
|
||||
let mut video_conn_count = 0;
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
let mut id = "".to_owned();
|
||||
#[cfg(any(
|
||||
@@ -1204,8 +1208,9 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
*TEMPORARY_PASSWD.lock().unwrap() = value;
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "flutter")]
|
||||
Ok(Some(ipc::Data::VideoConnCount(Some(n)))) => {
|
||||
VIDEO_CONN_COUNT.store(n, Ordering::Relaxed);
|
||||
video_conn_count = n;
|
||||
}
|
||||
Ok(Some(ipc::Data::OnlineStatus(Some((mut x, _c))))) => {
|
||||
if x > 0 {
|
||||
@@ -1223,6 +1228,8 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
mouse_time,
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
id: id.clone(),
|
||||
#[cfg(feature = "flutter")]
|
||||
video_conn_count,
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
@@ -1236,6 +1243,7 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
c.send(&ipc::Data::Options(None)).await.ok();
|
||||
c.send(&ipc::Data::Config(("id".to_owned(), None))).await.ok();
|
||||
c.send(&ipc::Data::Config(("temporary-password".to_owned(), None))).await.ok();
|
||||
#[cfg(feature = "flutter")]
|
||||
c.send(&ipc::Data::VideoConnCount(None)).await.ok();
|
||||
}
|
||||
}
|
||||
@@ -1256,6 +1264,8 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||
mouse_time,
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
id: id.clone(),
|
||||
#[cfg(feature = "flutter")]
|
||||
video_conn_count,
|
||||
};
|
||||
sleep(1.).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user