fix: rebase conflict
This commit is contained in:
parent
8a6c3fe70a
commit
c96c0df645
@ -1,3 +1,8 @@
|
|||||||
|
use crate::log;
|
||||||
|
use directories_next::ProjectDirs;
|
||||||
|
use rand::Rng;
|
||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use sodiumoxide::crypto::sign;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs,
|
fs,
|
||||||
|
@ -230,7 +230,7 @@ pub struct TransferJobMeta {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub file_num: i32,
|
pub file_num: i32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub is_remote: bool
|
pub is_remote: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||||
@ -299,11 +299,10 @@ impl TransferJob {
|
|||||||
file_num: i32,
|
file_num: i32,
|
||||||
show_hidden: bool,
|
show_hidden: bool,
|
||||||
is_remote: bool,
|
is_remote: bool,
|
||||||
include_hidden: bool,
|
|
||||||
enable_override_detection: bool,
|
enable_override_detection: bool,
|
||||||
) -> ResultType<Self> {
|
) -> ResultType<Self> {
|
||||||
log::info!("new read {}", path);
|
log::info!("new read {}", path);
|
||||||
let files = get_recursive_files(&path, include_hidden)?;
|
let files = get_recursive_files(&path, show_hidden)?;
|
||||||
let total_size = files.iter().map(|x| x.size as u64).sum();
|
let total_size = files.iter().map(|x| x.size as u64).sum();
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
id,
|
id,
|
||||||
@ -597,7 +596,7 @@ impl TransferJob {
|
|||||||
to: self.path.to_string_lossy().to_string(),
|
to: self.path.to_string_lossy().to_string(),
|
||||||
file_num: self.file_num,
|
file_num: self.file_num,
|
||||||
show_hidden: self.show_hidden,
|
show_hidden: self.show_hidden,
|
||||||
is_remote: self.is_remote
|
is_remote: self.is_remote,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,10 @@ pub trait FileManager: Interface {
|
|||||||
id: i32,
|
id: i32,
|
||||||
path: String,
|
path: String,
|
||||||
to: String,
|
to: String,
|
||||||
|
file_num: i32,
|
||||||
include_hidden: bool,
|
include_hidden: bool,
|
||||||
is_remote: bool,
|
is_remote: bool,
|
||||||
) {
|
) {
|
||||||
self.send(Data::SendFiles((id, path, to, include_hidden, is_remote)));
|
self.send(Data::SendFiles((id, path, to, file_num, include_hidden, is_remote)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Account", "Аккаунт"),
|
("Account", "Аккаунт"),
|
||||||
("Quit", "Выйти"),
|
("Quit", "Выйти"),
|
||||||
("Overwrite", "крышка"),
|
("Overwrite", "крышка"),
|
||||||
("This file exists, skip or overwrite this file?", "Этот файл существует, пропустить или перезаписать этот файл?")
|
("This file exists, skip or overwrite this file?", "Этот файл существует, пропустить или перезаписать этот файл?"),
|
||||||
("doc_mac_permission", "https://rustdesk.com/docs/en/manual/mac/#enable-permissions"),
|
("doc_mac_permission", "https://rustdesk.com/docs/en/manual/mac/#enable-permissions"),
|
||||||
("Help", "Помощь"),
|
("Help", "Помощь"),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
|
@ -3,9 +3,10 @@ use super::{input_service::*, *};
|
|||||||
use crate::clipboard_file::*;
|
use crate::clipboard_file::*;
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use crate::common::update_clipboard;
|
use crate::common::update_clipboard;
|
||||||
use crate::ipc;
|
|
||||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
use crate::{common::MOBILE_INFO2, mobile::connection_manager::start_channel};
|
use crate::{common::MOBILE_INFO2, mobile::connection_manager::start_channel};
|
||||||
|
use crate::{ipc, VERSION};
|
||||||
|
use hbb_common::fs::can_enable_overwrite_detection;
|
||||||
use hbb_common::log::debug;
|
use hbb_common::log::debug;
|
||||||
use hbb_common::message_proto::file_transfer_send_confirm_request::Union;
|
use hbb_common::message_proto::file_transfer_send_confirm_request::Union;
|
||||||
use hbb_common::{
|
use hbb_common::{
|
||||||
@ -974,7 +975,16 @@ impl Connection {
|
|||||||
let id = s.id;
|
let id = s.id;
|
||||||
let od =
|
let od =
|
||||||
can_enable_overwrite_detection(get_version_number(VERSION));
|
can_enable_overwrite_detection(get_version_number(VERSION));
|
||||||
match fs::TransferJob::new_read(id, s.path.clone(), s.file_num, s.include_hidden, od) {
|
let path = s.path.clone();
|
||||||
|
match fs::TransferJob::new_read(
|
||||||
|
id,
|
||||||
|
"".to_string(),
|
||||||
|
path.clone(),
|
||||||
|
s.file_num,
|
||||||
|
s.include_hidden,
|
||||||
|
false,
|
||||||
|
od,
|
||||||
|
) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.send(fs::new_error(id, err, 0)).await;
|
self.send(fs::new_error(id, err, 0)).await;
|
||||||
}
|
}
|
||||||
|
@ -278,10 +278,10 @@ impl ConnectionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ipc::FS::WriteOffset {
|
ipc::FS::WriteOffset {
|
||||||
id,file_num,offset_blk
|
id,
|
||||||
} => {
|
file_num,
|
||||||
|
offset_blk,
|
||||||
}
|
} => {}
|
||||||
},
|
},
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Data::ClipbaordFile(_clip) => {
|
Data::ClipbaordFile(_clip) => {
|
||||||
|
@ -20,7 +20,6 @@ use clipboard::{
|
|||||||
get_rx_clip_client, server_clip_file,
|
get_rx_clip_client, server_clip_file,
|
||||||
};
|
};
|
||||||
use enigo::{self, Enigo, KeyboardControllable};
|
use enigo::{self, Enigo, KeyboardControllable};
|
||||||
use hbb_common::{config::TransferSerde, fs::TransferJobMeta};
|
|
||||||
use hbb_common::fs::{
|
use hbb_common::fs::{
|
||||||
can_enable_overwrite_detection, get_string, is_file_exists, new_send_confirm,
|
can_enable_overwrite_detection, get_string, is_file_exists, new_send_confirm,
|
||||||
DigestCheckResult, RemoveJobMeta,
|
DigestCheckResult, RemoveJobMeta,
|
||||||
@ -41,6 +40,7 @@ use hbb_common::{
|
|||||||
},
|
},
|
||||||
Stream,
|
Stream,
|
||||||
};
|
};
|
||||||
|
use hbb_common::{config::TransferSerde, fs::TransferJobMeta};
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use crate::clipboard_file::*;
|
use crate::clipboard_file::*;
|
||||||
@ -1549,9 +1549,17 @@ impl Remote {
|
|||||||
for job_str in pc.transfer.read_jobs.iter() {
|
for job_str in pc.transfer.read_jobs.iter() {
|
||||||
let job: Result<TransferJobMeta, serde_json::Error> = serde_json::from_str(&job_str);
|
let job: Result<TransferJobMeta, serde_json::Error> = serde_json::from_str(&job_str);
|
||||||
if let Ok(job) = job {
|
if let Ok(job) = job {
|
||||||
self.handler.call("addJob",&make_args!(
|
self.handler.call(
|
||||||
cnt,job.to.clone(),job.remote.clone(),job.file_num,job.show_hidden, false
|
"addJob",
|
||||||
));
|
&make_args!(
|
||||||
|
cnt,
|
||||||
|
job.to.clone(),
|
||||||
|
job.remote.clone(),
|
||||||
|
job.file_num,
|
||||||
|
job.show_hidden,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
);
|
||||||
cnt += 1;
|
cnt += 1;
|
||||||
println!("restore read_job: {:?}", job);
|
println!("restore read_job: {:?}", job);
|
||||||
}
|
}
|
||||||
@ -1559,9 +1567,17 @@ impl Remote {
|
|||||||
for job_str in pc.transfer.write_jobs.iter() {
|
for job_str in pc.transfer.write_jobs.iter() {
|
||||||
let job: Result<TransferJobMeta, serde_json::Error> = serde_json::from_str(&job_str);
|
let job: Result<TransferJobMeta, serde_json::Error> = serde_json::from_str(&job_str);
|
||||||
if let Ok(job) = job {
|
if let Ok(job) = job {
|
||||||
self.handler.call("addJob",&make_args!(
|
self.handler.call(
|
||||||
cnt,job.remote.clone(),job.to.clone(),job.file_num,job.show_hidden, true
|
"addJob",
|
||||||
));
|
&make_args!(
|
||||||
|
cnt,
|
||||||
|
job.remote.clone(),
|
||||||
|
job.to.clone(),
|
||||||
|
job.file_num,
|
||||||
|
job.show_hidden,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
);
|
||||||
cnt += 1;
|
cnt += 1;
|
||||||
println!("restore write_job: {:?}", job);
|
println!("restore write_job: {:?}", job);
|
||||||
}
|
}
|
||||||
@ -1591,11 +1607,30 @@ impl Remote {
|
|||||||
let od = can_enable_overwrite_detection(self.handler.lc.read().unwrap().version);
|
let od = can_enable_overwrite_detection(self.handler.lc.read().unwrap().version);
|
||||||
if is_remote {
|
if is_remote {
|
||||||
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
||||||
self.write_jobs
|
self.write_jobs.push(fs::TransferJob::new_write(
|
||||||
.push(fs::TransferJob::new_write(id, path.clone(),to,file_num, include_hidden, is_remote, Vec::new(), od));
|
id,
|
||||||
allow_err!(peer.send(&fs::new_send(id, path,file_num, include_hidden)).await);
|
path.clone(),
|
||||||
|
to,
|
||||||
|
file_num,
|
||||||
|
include_hidden,
|
||||||
|
is_remote,
|
||||||
|
Vec::new(),
|
||||||
|
od,
|
||||||
|
));
|
||||||
|
allow_err!(
|
||||||
|
peer.send(&fs::new_send(id, path, file_num, include_hidden))
|
||||||
|
.await
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
match fs::TransferJob::new_read(id, to.clone(), path.clone(), file_num,include_hidden,is_remote, include_hidden, od) {
|
match fs::TransferJob::new_read(
|
||||||
|
id,
|
||||||
|
to.clone(),
|
||||||
|
path.clone(),
|
||||||
|
file_num,
|
||||||
|
include_hidden,
|
||||||
|
is_remote,
|
||||||
|
od,
|
||||||
|
) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||||
}
|
}
|
||||||
@ -2032,7 +2067,11 @@ impl Remote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(file_response::Union::block(block)) => {
|
Some(file_response::Union::block(block)) => {
|
||||||
log::info!("file response block, file id:{}, file num: {}",block.id, block.file_num);
|
log::info!(
|
||||||
|
"file response block, file id:{}, file num: {}",
|
||||||
|
block.id,
|
||||||
|
block.file_num
|
||||||
|
);
|
||||||
if let Some(job) = fs::get_job(block.id, &mut self.write_jobs) {
|
if let Some(job) = fs::get_job(block.id, &mut self.write_jobs) {
|
||||||
if let Err(_err) = job.write(block, None).await {
|
if let Err(_err) = job.write(block, None).await {
|
||||||
// to-do: add "skip" for writing job
|
// to-do: add "skip" for writing job
|
||||||
|
Loading…
x
Reference in New Issue
Block a user