From 99eb75f7582886cb71f5fb417ddb8ba81ac078be Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 3 Mar 2025 18:53:31 +0100 Subject: [PATCH] Add image segment --- .../src/components/CSegment.vue | 5 +- .../src/components/CSegmentImage.vue | 81 +++++++++++++++++++ .../src/documents/image/mod.rs | 4 +- showbits-thermal-printer/static/image.html | 31 ------- 4 files changed, 87 insertions(+), 34 deletions(-) create mode 100644 showbits-thermal-printer-ui/src/components/CSegmentImage.vue delete mode 100644 showbits-thermal-printer/static/image.html diff --git a/showbits-thermal-printer-ui/src/components/CSegment.vue b/showbits-thermal-printer-ui/src/components/CSegment.vue index b3bdd5b..8475ca1 100644 --- a/showbits-thermal-printer-ui/src/components/CSegment.vue +++ b/showbits-thermal-printer-ui/src/components/CSegment.vue @@ -6,9 +6,10 @@ import CSegmentText from "./CSegmentText.vue"; import CSegmentTictactoe from "./CSegmentTictactoe.vue"; import CSegmentCells from "./CSegmentCells.vue"; import CSegmentChat from "./CSegmentChat.vue"; +import CSegmentImage from "./CSegmentImage.vue"; const mode = ref< - "calendar" | "chat" | "cells" | "egg" | "text" | "tictactoe" + "calendar" | "chat" | "cells" | "egg" | "image" | "text" | "tictactoe" >(); @@ -19,6 +20,7 @@ const mode = ref< +
@@ -29,6 +31,7 @@ const mode = ref< + diff --git a/showbits-thermal-printer-ui/src/components/CSegmentImage.vue b/showbits-thermal-printer-ui/src/components/CSegmentImage.vue new file mode 100644 index 0000000..854395b --- /dev/null +++ b/showbits-thermal-printer-ui/src/components/CSegmentImage.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/showbits-thermal-printer/src/documents/image/mod.rs b/showbits-thermal-printer/src/documents/image/mod.rs index 04bd87a..6c4b56d 100644 --- a/showbits-thermal-printer/src/documents/image/mod.rs +++ b/showbits-thermal-printer/src/documents/image/mod.rs @@ -4,7 +4,7 @@ use anyhow::Context; use axum::{ extract::{Multipart, State}, http::StatusCode, - response::{IntoResponse, Redirect, Response}, + response::{IntoResponse, Response}, }; use image::ImageFormat; use serde::Serialize; @@ -77,5 +77,5 @@ pub async fn post(server: State, mut multipart: Multipart) -> somehow::R .with_main_file(include_str!("main.typ")); server.print_typst(typst).await; - Ok(Redirect::to("image").into_response()) + Ok(().into_response()) } diff --git a/showbits-thermal-printer/static/image.html b/showbits-thermal-printer/static/image.html deleted file mode 100644 index fe56f71..0000000 --- a/showbits-thermal-printer/static/image.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - TP: Image - - -

Upload an image

-
-
    -
  1. -
  2. - -
  3. -
  4. - Dithering algorithm: - -
  5. -
  6. - Scale: - -
  7. -
  8. -
-
- -