Revert "feat: clipboard, multi format (#8672)" (#8673)

This reverts commit 011647511c.
This commit is contained in:
RustDesk
2024-07-11 00:36:29 +08:00
committed by GitHub
parent 011647511c
commit ef4d84657b
10 changed files with 501 additions and 376 deletions

View File

@@ -1,7 +1,7 @@
use super::*;
pub use crate::clipboard::{
check_clipboard, get_cache_msg, ClipboardContext, ClipboardSide,
CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME,
check_clipboard, ClipboardContext, CLIPBOARD_INTERVAL as INTERVAL, CLIPBOARD_NAME as NAME,
CONTENT,
};
#[derive(Default)]
@@ -11,7 +11,7 @@ struct State {
impl super::service::Reset for State {
fn reset(&mut self) {
crate::clipboard::reset_cache();
*CONTENT.lock().unwrap() = Default::default();
self.ctx = None;
}
@@ -34,14 +34,14 @@ pub fn new() -> GenericService {
}
fn run(sp: EmptyExtraFieldService, state: &mut State) -> ResultType<()> {
if let Some(msg) = check_clipboard(&mut state.ctx, ClipboardSide::Host) {
if let Some(msg) = check_clipboard(&mut state.ctx, None) {
sp.send(msg);
}
sp.snapshot(|sps| {
// Just create a message with multi clipboards here
// The actual peer version and peer platform will be checked again before sending.
if let Some(msg) = get_cache_msg("1.2.7", "Windows") {
sps.send_shared(Arc::new(msg));
let data = CONTENT.lock().unwrap().clone();
if !data.is_empty() {
let msg_out = data.create_msg();
sps.send_shared(Arc::new(msg_out));
}
Ok(())
})?;