From 28c44b526c32fe3c6820435562c541ce1f5f3c9a Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Mar 2024 00:22:00 +0100 Subject: [PATCH] Add /egg --- showbits-thermal-printer/src/server.rs | 5 ++- showbits-thermal-printer/static/egg.html | 50 ++++++++++++++++++++++ showbits-thermal-printer/static/index.html | 1 + 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 showbits-thermal-printer/static/egg.html diff --git a/showbits-thermal-printer/src/server.rs b/showbits-thermal-printer/src/server.rs index dfe1777..12973be 100644 --- a/showbits-thermal-printer/src/server.rs +++ b/showbits-thermal-printer/src/server.rs @@ -29,7 +29,7 @@ pub async fn run(tx: mpsc::Sender, addr: String) -> anyhow::Result<()> .route("/calendar", post(post_calendar)) .route("/cells", post(post_cells)) .route("/chat_message", post(post_chat_message)) - .route("/egg", post(post_egg)) + .route("/egg", post(post_egg).fallback(get_static_file)) .route("/image", post(post_image).fallback(get_static_file)) .route("/photo", post(post_photo).fallback(get_static_file)) .route("/text", post(post_text)) @@ -100,8 +100,9 @@ async fn post_chat_message(server: State, request: Form) { +async fn post_egg(server: State) -> impl IntoResponse { let _ = server.tx.send(Command::draw(EggDrawing)).await; + Redirect::to("egg") } // /image diff --git a/showbits-thermal-printer/static/egg.html b/showbits-thermal-printer/static/egg.html new file mode 100644 index 0000000..295d290 --- /dev/null +++ b/showbits-thermal-printer/static/egg.html @@ -0,0 +1,50 @@ + + + + + + Osterei + + + +
+ +
+ + diff --git a/showbits-thermal-printer/static/index.html b/showbits-thermal-printer/static/index.html index 1e09797..97c3a21 100644 --- a/showbits-thermal-printer/static/index.html +++ b/showbits-thermal-printer/static/index.html @@ -10,6 +10,7 @@