Add basic connect command

This commit is contained in:
LDprg 2023-10-07 19:21:37 +02:00
parent 15da1b7c8a
commit 437a43c7fe
2 changed files with 20 additions and 6 deletions

View File

@ -6,20 +6,34 @@ pub mod freerdp_back {
pub struct Freerdp {} pub struct Freerdp {}
impl RemoteClient for Freerdp { impl RemoteClient for Freerdp {
fn check_depends(&self, _config: Config) { fn check_depends(&self, config: Config) {
let mut xfreerdp = Command::new("xfreerdp"); let mut xfreerdp = Command::new("xfreerdp");
xfreerdp.stdout(Stdio::null()); xfreerdp.stdout(Stdio::null());
xfreerdp.args(["-h"]); xfreerdp.args(["-h"]);
xfreerdp xfreerdp
.spawn() .spawn()
.expect("Freerdp execution failed! It needs to be installed!"); .expect("Freerdp execution failed! It needs to be installed!");
println!("Freerdp found!"); println!("Freerdp found!");
println!("All dependencies found!"); println!("All dependencies found!");
println!("Running explorer as test!");
self.run_app(config, "explorer");
println!("Test finished!");
} }
fn run_app(&self, _config: Config, _app: &str) { fn run_app(&self, config: Config, _app: &str) {
todo!() let mut xfreerdp = Command::new("xfreerdp");
xfreerdp.args([
//"/app:".to_owned() + app,
"/d:".to_owned() + &config.rdp.domain,
"/u:".to_owned() + &config.rdp.username,
"/p:".to_owned() + &config.rdp.password,
"/v:".to_owned() + &config.rdp.host,
]);
xfreerdp.spawn().expect("Freerdp execution failed!");
} }
} }
} }

View File

@ -31,13 +31,13 @@ pub struct HostConfig {
#[derive(new, Debug, Deserialize, Serialize)] #[derive(new, Debug, Deserialize, Serialize)]
pub struct RemoteConfig { pub struct RemoteConfig {
#[new(value = "\"RDPWindows\".to_string()")] #[new(value = "\"127.0.0.1\".to_string()")]
host: String, host: String,
#[new(value = "\"WORKGROUP\".to_string()")] #[new(value = "\"WORKGROUP\".to_string()")]
domain: String, domain: String,
#[new(value = "\"RDPUser\".to_string()")] #[new(value = "\"Quickemu\".to_string()")]
username: String, username: String,
#[new(value = "\"RDPPass\".to_string()")] #[new(value = "\"quickemu\".to_string()")]
password: String, password: String,
} }