mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 14:07:28 +08:00
feat: clipboard files, audit (#12730)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -633,7 +633,22 @@ impl Connection {
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
ipc::Data::ClipboardFile(clip) => {
|
||||
allow_err!(conn.stream.send(&clip_2_msg(clip)).await);
|
||||
match clip {
|
||||
clipboard::ClipboardFile::Files { files } => {
|
||||
let files = files.into_iter().map(|(f, s)| {
|
||||
(f, s as i64)
|
||||
}).collect::<Vec<_>>();
|
||||
conn.post_file_audit(
|
||||
FileAuditType::RemoteSend,
|
||||
"",
|
||||
files,
|
||||
json!({}),
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
allow_err!(conn.stream.send(&clip_2_msg(clip)).await);
|
||||
}
|
||||
}
|
||||
}
|
||||
ipc::Data::PrivacyModeState((_, state, impl_key)) => {
|
||||
let msg_out = match state {
|
||||
@@ -2463,14 +2478,25 @@ impl Connection {
|
||||
}
|
||||
#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))]
|
||||
Some(message::Union::Cliprdr(clip)) => {
|
||||
if let Some(clip) = msg_2_clip(clip) {
|
||||
if let Some(cliprdr::Union::Files(files)) = &clip.union {
|
||||
self.post_file_audit(
|
||||
FileAuditType::RemoteReceive,
|
||||
"",
|
||||
files
|
||||
.files
|
||||
.iter()
|
||||
.map(|f| (f.name.clone(), f.size as i64))
|
||||
.collect::<Vec<(String, i64)>>(),
|
||||
json!({}),
|
||||
);
|
||||
} else if let Some(clip) = msg_2_clip(clip) {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
self.send_to_cm(ipc::Data::ClipboardFile(clip));
|
||||
}
|
||||
#[cfg(feature = "unix-file-copy-paste")]
|
||||
if crate::is_support_file_copy_paste(&self.lr.version) {
|
||||
let mut out_msg = None;
|
||||
let mut out_msgs = vec![];
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
if clipboard::platform::unix::macos::should_handle_msg(&clip) {
|
||||
@@ -2485,7 +2511,7 @@ impl Connection {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
out_msg = unix_file_clip::serve_clip_messages(
|
||||
out_msgs = unix_file_clip::serve_clip_messages(
|
||||
ClipboardSide::Host,
|
||||
clip,
|
||||
self.inner.id(),
|
||||
@@ -2494,14 +2520,31 @@ impl Connection {
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
out_msg = unix_file_clip::serve_clip_messages(
|
||||
out_msgs = unix_file_clip::serve_clip_messages(
|
||||
ClipboardSide::Host,
|
||||
clip,
|
||||
self.inner.id(),
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(msg) = out_msg {
|
||||
for msg in out_msgs.into_iter() {
|
||||
if let Some(message::Union::Cliprdr(cliprdr)) = msg.union.as_ref() {
|
||||
if let Some(cliprdr::Union::Files(files)) =
|
||||
cliprdr.union.as_ref()
|
||||
{
|
||||
self.post_file_audit(
|
||||
FileAuditType::RemoteSend,
|
||||
"",
|
||||
files
|
||||
.files
|
||||
.iter()
|
||||
.map(|f| (f.name.clone(), f.size as i64))
|
||||
.collect::<Vec<(String, i64)>>(),
|
||||
json!({}),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
self.send(msg).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user