Get tp server and ui dev server to talk to each other

This commit is contained in:
Joscha 2025-03-03 00:26:47 +01:00
parent 328922bd7b
commit 1cb07fb126
5 changed files with 46 additions and 29 deletions

View file

@ -15,12 +15,13 @@ use self::{drawer::Drawer, persistent_printer::PersistentPrinter};
#[derive(Parser)]
struct Args {
/// Address the web server will listen at.
addr: String,
/// Path to the queue directory.
queue: PathBuf,
/// Address the web server will listen at.
#[arg(long, short, default_value = "localhost:8080")]
address: String,
/// Path to the printer's USB device file.
///
/// Usually, this is located at `/dev/usb/lp0` or a similar location.
@ -41,7 +42,7 @@ fn main() -> anyhow::Result<()> {
let mut drawer = Drawer::new(rx, printer);
let runtime = Runtime::new()?;
runtime.spawn(server::run(tx.clone(), args.addr));
runtime.spawn(server::run(tx.clone(), args.address));
runtime.spawn(async move {
loop {
let _ = tx.send(Command::Backlog).await;