fixed a bug on new project creation where the config file path wasn't

being passed correctly. Also started the groundwork for adding more of
my rust based tooling to tetanus.
This commit is contained in:
pyro committed 2026-08-27 12:23:18 -05:00
1 parent 9ed69b03a0
commit 0bb3a125aa
6 files changed
+1469 -167

No files matched your search

+45
View File
@@ -22,6 +22,7 @@ use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
enum ClientAction {
Output(String),
Cmd(String),
Collab(String),
}
pub struct Client {
@@ -31,6 +32,7 @@ pub struct Client {
actions: Vec<ClientAction>,
controlling: usize,
controlled: usize,
collabing: Vec<usize>,
output_que: Vec<String>,
logged_in: bool,
timer: Duration,
@@ -201,6 +203,7 @@ where
actions: Vec::new(),
controlled: 0,
controlling: 0,
collabing: Vec::new(),
output_que: Vec::new(),
logged_in: false,
timer: Duration::from_secs(5),
@@ -312,6 +315,26 @@ where
dest_client.id, cmd
)));
}
else{
let mut colabs = Vec::new();
lock.clients.iter_mut().filter(|c| c.id == source_id).for_each(|c|{
if c.collabing.is_empty(){
c.actions.push(ClientAction::Output("Error no controlled or collabed clients associated with you!".to_string()));
}
else{
c.collabing.iter().for_each(|id|{
colabs.push(id.clone());
});
}
});
if !colabs.is_empty(){
colabs.iter().for_each(|id|{
lock.clients.iter_mut().filter(|c| &c.id == id).for_each(|c|{
c.actions.push(ClientAction::Cmd(data.to_string()));
});
});
}
}
}
"CONTROL" => {
let new_control_id = data.trim().parse::<usize>().unwrap();
@@ -429,6 +452,22 @@ where
c.remove = true;
});
}
"COLLAB" => {
let dest_id: usize = data.trim().parse().unwrap();
lock.clients
.iter_mut()
.filter(|c| c.id == source_id)
.for_each(|c| {
c.collabing.push(dest_id.clone());
});
lock.clients
.iter_mut()
.filter(|d| d.id == dest_id)
.for_each(|d| {
d.collabing.push(dest_id.clone());
});
println!("{} is collabing with {}", source_id, dest_id);
}
"SLEEP" => {
if let Ok(secs) = data.parse::<u64>() {
lock.clients
@@ -455,6 +494,9 @@ where
println!("adding {} to output", text);
messages.push(format!("OUTPUT|{}", text));
}
ClientAction::Collab(text) => {
println!("todo");
}
}
}
let full_message = messages.join("||");
@@ -523,6 +565,9 @@ where
println!("adding {} to output", text);
messages.push(format!("OUTPUT|{}", text));
}
ClientAction::Collab(text) => {
println!("todo");
}
}
}
let full_message = messages.join("||");