feat: replace prompt with inform (fire-and-forget), logs default 20 lines

This commit is contained in:
Helios Agent 2026-03-06 03:13:42 +01:00
parent d2f77f8054
commit af0b6b5ddb
No known key found for this signature in database
GPG key ID: C8259547CD8309B5
5 changed files with 51 additions and 13 deletions

View file

@ -275,8 +275,8 @@ enum Commands {
device: String,
},
/// Show a MessageBox asking the user to do something
Prompt {
/// Show a notification to the user (fire-and-forget, no response needed)
Inform {
/// Device label
device: String,
/// Message to display
@ -342,7 +342,7 @@ enum Commands {
/// Device label
device: String,
/// Number of lines
#[arg(long, default_value = "100")]
#[arg(long, default_value = "20")]
lines: u32,
},
}
@ -537,7 +537,7 @@ fn main() {
println!("All windows minimized on {}.", device);
}
Commands::Prompt {
Commands::Inform {
device,
message,
title,
@ -547,19 +547,14 @@ fn main() {
if let Some(t) = title {
body["title"] = json!(t);
}
let data = req(
req(
&cfg,
"POST",
&format!("/devices/{}/prompt", device),
&format!("/devices/{}/inform", device),
Some(body),
30,
10,
);
let answer = data["answer"].as_str().unwrap_or("");
if !answer.is_empty() {
println!("{}", answer);
} else {
println!("Prompt confirmed.");
}
println!("User informed on {}.", device);
}
Commands::Run {