fix cm event listener & switch permission

This commit is contained in:
csf
2022-08-18 19:49:41 +08:00
parent 968cff967e
commit 2c7f0d7588
4 changed files with 87 additions and 133 deletions

View File

@@ -41,6 +41,7 @@ use crate::{client::*, flutter_ffi::EventToUI, make_fd_flutter};
pub(super) const APP_TYPE_MAIN: &str = "main";
pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote";
pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer";
pub(super) const APP_TYPE_DESKTOP_CONNECTION_MANAGER: &str = "connection manager";
lazy_static::lazy_static! {
// static ref SESSION: Arc<RwLock<Option<Session>>> = Default::default();
@@ -1678,6 +1679,8 @@ pub mod connection_manager {
keyboard: bool,
clipboard: bool,
audio: bool,
file: bool,
restart: bool,
#[serde(skip)]
tx: UnboundedSender<Data>,
}
@@ -1885,8 +1888,8 @@ pub mod connection_manager {
keyboard: bool,
clipboard: bool,
audio: bool,
_file: bool,
_restart: bool,
file: bool,
restart: bool,
tx: mpsc::UnboundedSender<Data>,
) {
let mut client = Client {
@@ -1898,6 +1901,8 @@ pub mod connection_manager {
keyboard,
clipboard,
audio,
file,
restart,
tx,
};
if authorized {
@@ -1935,7 +1940,7 @@ pub mod connection_manager {
if let Some(s) = GLOBAL_EVENT_STREAM
.read()
.unwrap()
.get(super::APP_TYPE_MAIN)
.get(super::APP_TYPE_DESKTOP_CONNECTION_MANAGER)
{
s.add(serde_json::ser::to_string(&h).unwrap_or("".to_owned()));
};