Compare commits

...

2 Commits

Author SHA1 Message Date
uelen 1e67b80d10 Fixup cargo.toml to point to git again
Oops
2026-05-30 22:21:56 -07:00
uelen 6024798053 Only show last message
This stops intermediate commands from showing things like auth
succeeding every time
2026-05-30 22:19:56 -07:00
3 changed files with 18 additions and 5 deletions
Generated
+1
View File
@@ -397,6 +397,7 @@ dependencies = [
[[package]]
name = "fedichat"
version = "0.1.0"
source = "git+https://git.firechicken.net/fedichat/fedichat-lib#49cbd905ceecb7bf7be463f81836742e3a7ddc24"
dependencies = [
"serde",
"serde_bytes",
+2 -2
View File
@@ -5,8 +5,8 @@ edition = "2024"
[dependencies]
quinn = "0.11.9"
#fedichat = {git = "https://git.firechicken.net/fedichat/fedichat-lib"}
fedichat = {path = "../fedichat-lib"}
fedichat = {git = "https://git.firechicken.net/fedichat/fedichat-lib"}
#fedichat = {path = "../fedichat-lib"}
tracing = "0.1.44"
tracing-subscriber = "0.3.23"
clap = { version = "4.6.1", features = ["derive"] }
+15 -3
View File
@@ -90,6 +90,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
debug!("Sending commands");
let mut response: fedichat::client::ServerMessage = ServerMessage::Ok;
for message in messages {
let mut buf = Vec::new();
@@ -104,7 +106,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Max response should never be this big but we can spare the memory
let received = recv.read_to_end(1000 * 1000).await?;
let response: fedichat::client::ServerMessage = rmp_serde::from_slice(&received)?;
response = rmp_serde::from_slice(&received)?;
// If we received a message that gave us a new token then update the local copy
match response {
ServerMessage::Token(ref token) => {
@@ -114,12 +116,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut file = File::create(file_to_write.clone().expect("File path not specified"))?;
file.write_all(bytes)?;
},
ServerMessage::Error(_) => {
break;
},
_ => {}
}
println!("{:?}",response);
}
println!("{}",format_response(response));
// On listen specifically we will stay connected
@@ -128,6 +133,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
fn format_response(m: ServerMessage) -> String {
match m {
ServerMessage::Media(_) => "File received".to_string(),
m => format!("{:?}",m)
}
}