mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
add: meta info
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::SocketAddr,
|
||||
ops::Deref,
|
||||
sync::{mpsc, Arc, RwLock},
|
||||
};
|
||||
|
||||
pub use async_trait::async_trait;
|
||||
#[cfg(not(any(target_os = "android", target_os = "linux")))]
|
||||
use cpal::{
|
||||
traits::{DeviceTrait, HostTrait, StreamTrait},
|
||||
Device, Host, StreamConfig,
|
||||
};
|
||||
use magnum_opus::{Channels::*, Decoder as AudioDecoder};
|
||||
use sha2::{Digest, Sha256};
|
||||
use uuid::Uuid;
|
||||
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
anyhow::{anyhow, Context},
|
||||
@@ -19,24 +30,15 @@ use hbb_common::{
|
||||
tokio::time::Duration,
|
||||
AddrMangle, ResultType, Stream,
|
||||
};
|
||||
use magnum_opus::{Channels::*, Decoder as AudioDecoder};
|
||||
use scrap::{Decoder, Image, VideoCodecId};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::SocketAddr,
|
||||
ops::Deref,
|
||||
sync::{mpsc, Arc, RwLock},
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub use super::lang::*;
|
||||
pub mod file_trait;
|
||||
pub use file_trait::FileManager;
|
||||
pub const SEC30: Duration = Duration::from_secs(30);
|
||||
|
||||
pub struct Client;
|
||||
|
||||
pub use super::lang::*;
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "linux")))]
|
||||
lazy_static::lazy_static! {
|
||||
static ref AUDIO_HOST: Host = cpal::default_host();
|
||||
@@ -1324,6 +1326,7 @@ pub enum Data {
|
||||
ToggleClipboardFile,
|
||||
NewRDP,
|
||||
SetConfirmOverrideFile((i32, i32, bool, bool, bool)),
|
||||
ResumeTransfer,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
#[cfg(windows)]
|
||||
use crate::clipboard_file::*;
|
||||
use crate::{
|
||||
client::*,
|
||||
common::{self, check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL},
|
||||
VERSION,
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
ops::Deref,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
};
|
||||
|
||||
use sciter::{
|
||||
dom::{
|
||||
event::{EventReason, BEHAVIOR_EVENTS, EVENT_GROUPS, PHASE_MASK},
|
||||
Element, HELEMENT,
|
||||
},
|
||||
make_args,
|
||||
video::{video_destination, AssetPtr, COLOR_SPACE},
|
||||
Value,
|
||||
};
|
||||
|
||||
#[cfg(windows)]
|
||||
use clipboard::{
|
||||
cliprdr::CliprdrClientContext, create_cliprdr_context as create_clipboard_file_context,
|
||||
get_rx_clip_client, server_clip_file,
|
||||
};
|
||||
use enigo::{self, Enigo, KeyboardControllable};
|
||||
use hbb_common::config::TransferSerde;
|
||||
use hbb_common::fs::{
|
||||
can_enable_overwrite_detection, get_string, is_file_exists, new_send_confirm, DigestCheckResult,
|
||||
can_enable_overwrite_detection, get_string, is_file_exists, new_send_confirm,
|
||||
DigestCheckResult, RemoveJobMeta,
|
||||
};
|
||||
use hbb_common::log::log;
|
||||
use hbb_common::{
|
||||
@@ -30,19 +41,13 @@ use hbb_common::{
|
||||
},
|
||||
Stream,
|
||||
};
|
||||
use sciter::{
|
||||
dom::{
|
||||
event::{EventReason, BEHAVIOR_EVENTS, EVENT_GROUPS, PHASE_MASK},
|
||||
Element, HELEMENT,
|
||||
},
|
||||
make_args,
|
||||
video::{video_destination, AssetPtr, COLOR_SPACE},
|
||||
Value,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
ops::Deref,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
|
||||
#[cfg(windows)]
|
||||
use crate::clipboard_file::*;
|
||||
use crate::{
|
||||
client::*,
|
||||
common::{self, check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL},
|
||||
VERSION,
|
||||
};
|
||||
|
||||
type Video = AssetPtr<video_destination>;
|
||||
@@ -1314,6 +1319,7 @@ async fn io_loop(handler: Handler) {
|
||||
clipboard_file_context: None,
|
||||
};
|
||||
remote.io_loop(&key, &token).await;
|
||||
remote.sync_jobs_status_to_local();
|
||||
}
|
||||
|
||||
struct RemoveJob {
|
||||
@@ -1336,6 +1342,14 @@ impl RemoveJob {
|
||||
last_update_job_status: Instant::now(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gen_meta(&self) -> RemoveJobMeta {
|
||||
RemoveJobMeta {
|
||||
path: self.path.clone(),
|
||||
is_remote: self.is_remote,
|
||||
no_confirm: self.no_confirm,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Remote {
|
||||
@@ -1438,6 +1452,7 @@ impl Remote {
|
||||
}
|
||||
}
|
||||
}
|
||||
self.sync_jobs_status_to_local();
|
||||
log::debug!("Exit io_loop of id={}", self.handler.id);
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -1782,6 +1797,23 @@ impl Remote {
|
||||
}
|
||||
}
|
||||
|
||||
async fn sync_jobs_status_to_local(&mut self) -> bool {
|
||||
let mut config: PeerConfig = self.handler.load_config();
|
||||
let mut transfer_metas = TransferSerde::default();
|
||||
for job in self.read_jobs.iter() {
|
||||
transfer_metas.read_jobs.push(job.gen_meta());
|
||||
}
|
||||
for job in self.write_jobs.iter() {
|
||||
transfer_metas.write_jobs.push(job.gen_meta());
|
||||
}
|
||||
for job in self.remove_jobs.values() {
|
||||
transfer_metas.remove_jobs.push(job.gen_meta());
|
||||
}
|
||||
config.transfer = transfer_metas;
|
||||
self.handler.save_config(config);
|
||||
true
|
||||
}
|
||||
|
||||
async fn handle_msg_from_peer(&mut self, data: &[u8], peer: &mut Stream) -> bool {
|
||||
if let Ok(msg_in) = Message::parse_from_bytes(&data) {
|
||||
match msg_in.union {
|
||||
|
||||
Reference in New Issue
Block a user