mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
add: sortby, address link, platform, last jobs[1/2]
This commit is contained in:
@@ -5,6 +5,8 @@ use std::{
|
||||
|
||||
use flutter_rust_bridge::{StreamSink, ZeroCopyBuffer};
|
||||
|
||||
use hbb_common::config::PeerConfig;
|
||||
use hbb_common::fs::TransferJobMeta;
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
compress::decompress,
|
||||
@@ -464,6 +466,41 @@ impl Session {
|
||||
log::debug!("{:?}", msg_out);
|
||||
self.send_msg(msg_out);
|
||||
}
|
||||
|
||||
pub fn load_config(&self) -> PeerConfig {
|
||||
load_config(&self.id)
|
||||
}
|
||||
|
||||
pub fn get_platform(&self, is_remote: bool) -> String {
|
||||
if is_remote {
|
||||
self.lc.read().unwrap().info.platform.clone()
|
||||
} else {
|
||||
whoami::platform().to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_last_jobs(&self) {
|
||||
let pc = self.load_config();
|
||||
if pc.transfer.write_jobs.is_empty() && pc.transfer.read_jobs.is_empty() {
|
||||
// no last jobs
|
||||
return;
|
||||
}
|
||||
let mut cnt = 1;
|
||||
for job_str in pc.transfer.read_jobs.iter() {
|
||||
if !job_str.is_empty() {
|
||||
self.push_event("addJob", vec![("value", job_str)]);
|
||||
cnt += 1;
|
||||
println!("restore read_job: {:?}", job);
|
||||
}
|
||||
}
|
||||
for job_str in pc.transfer.write_jobs.iter() {
|
||||
if !job_str.is_empty() {
|
||||
self.push_event("addJob", vec![("value", job_str)]);
|
||||
cnt += 1;
|
||||
println!("restore write_job: {:?}", job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FileManager for Session {}
|
||||
|
||||
@@ -339,6 +339,19 @@ pub fn session_read_local_dir_sync(id: String, path: String, show_hidden: bool)
|
||||
"".to_string()
|
||||
}
|
||||
|
||||
pub fn session_get_platform(id: String, is_remote: bool) -> String {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
return session.get_platform(is_remote);
|
||||
}
|
||||
"".to_string()
|
||||
}
|
||||
|
||||
pub fn session_load_last_transfer_jobs(id: String) {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
return session.load_last_jobs();
|
||||
}
|
||||
}
|
||||
|
||||
/// FFI for **get** commands which are idempotent.
|
||||
/// Return result in c string.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user