Typstify /egg endpoint

This commit is contained in:
Joscha 2025-03-01 18:32:56 +01:00
parent 6d4db1ca2e
commit db06addc42
12 changed files with 141 additions and 112 deletions

View file

@ -15,8 +15,8 @@ use tokio::{net::TcpListener, sync::mpsc};
use crate::{
documents,
drawer::{
CalendarDrawing, CellsDrawing, ChatMessageDrawing, Command, EggDrawing, PhotoDrawing,
TicTacToeDrawing, TypstDrawing,
CalendarDrawing, CellsDrawing, ChatMessageDrawing, Command, PhotoDrawing, TicTacToeDrawing,
TypstDrawing,
},
};
@ -32,7 +32,7 @@ pub async fn run(tx: mpsc::Sender<Command>, 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).fallback(get_static_file))
.route("/egg", post(documents::egg::post).fallback(get_static_file))
.route(
"/image",
post(documents::image::post).fallback(get_static_file),
@ -109,13 +109,6 @@ async fn post_chat_message(server: State<Server>, request: Form<PostChatMessageF
.await;
}
// /egg
async fn post_egg(server: State<Server>) -> impl IntoResponse {
let _ = server.tx.send(Command::draw(EggDrawing)).await;
Redirect::to("egg")
}
// /photo
async fn post_photo(server: State<Server>, mut multipart: Multipart) -> somehow::Result<Response> {