Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix(file transfer): perm on "access-mode" (#13971)

fufesou4d3ccc62e868
diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs
index d1c1d21ef..d6792c111 100644
--- a/src/ui_cm_interface.rs
+++ b/src/ui_cm_interface.rs
@@ -772,10 +772,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
#[tokio::main(flavor = "current_thread")]
pub async fn start_ipc<T: InvokeUiCM>(cm: ConnectionManager<T>) {
#[cfg(target_os = "windows")]
- ContextSend::enable(option2bool(
- OPTION_ENABLE_FILE_TRANSFER,
- &Config::get_option(OPTION_ENABLE_FILE_TRANSFER),
- ));
+ ContextSend::enable(crate::Connection::permission(OPTION_ENABLE_FILE_TRANSFER));
match ipc::new_listener("_cm").await {
Ok(mut incoming) => {
while let Some(result) = incoming.next().await {
diff --git a/src/ui_interface.rs b/src/ui_interface.rs
index 516e4fede..549337aea 100644
--- a/src/ui_interface.rs
+++ b/src/ui_interface.rs
@@ -1167,6 +1167,8 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
#[cfg(not(feature = "flutter"))]
let mut id = "".to_owned();
#[cfg(target_os = "windows")]
+ let mut access_mode = "".to_owned();
+ #[cfg(target_os = "windows")]
let mut enable_file_transfer = "".to_owned();
let is_cm = crate::common::is_cm();
@@ -1195,10 +1197,23 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
#[cfg(target_os = "windows")]
{
- 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(config::option2bool(OPTION_ENABLE_FILE_TRANSFER, &b));
- enable_file_transfer = b;
+ let (ft, am) = {
+ let lock = OPTIONS.lock().unwrap();
+ (
+ lock.get(OPTION_ENABLE_FILE_TRANSFER).map(|x| x.to_string()).unwrap_or_default(),
+ lock.get(OPTION_ACCESS_MODE).map(|x| x.to_string()).unwrap_or_default(),
+ )
+ };
+ if ft != enable_file_transfer || am != access_mode {
+ let access_mode_enabled = match am.as_str() {
+ "full" => Some(true),
+ "view" => Some(false),
+ _ => None,
+ };
+ let enabled = access_mode_enabled.unwrap_or(config::option2bool(OPTION_ENABLE_FILE_TRANSFER, &ft));
+ clipboard::ContextSend::enable(enabled);
+ enable_file_transfer = ft;
+ access_mode = am;
}
}
}