Notify user whether uploaded images are saved

This commit is contained in:
Joscha 2025-04-09 14:59:27 +02:00
parent dad0f282c6
commit 8b0b07a367
3 changed files with 58 additions and 4 deletions

View file

@ -2,6 +2,7 @@ use std::{fs, io::Cursor};
use anyhow::{Context, anyhow, bail};
use axum::{
Json,
extract::{Multipart, State},
http::StatusCode,
response::{IntoResponse, Response},
@ -169,3 +170,14 @@ pub async fn post(server: State<Server>, mut multipart: Multipart) -> somehow::R
server.print_typst(typst).await?;
Ok(().into_response())
}
#[derive(Serialize)]
struct Info {
originals: bool,
}
pub async fn get(server: State<Server>) -> impl IntoResponse {
Json(Info {
originals: server.originals.is_some(),
})
}

View file

@ -47,7 +47,10 @@ pub async fn run(
.route("/api/cells", post(documents::cells::post))
.route("/api/chat", post(documents::chat::post))
.route("/api/egg", post(documents::egg::post))
.route("/api/image", post(documents::image::post))
.route(
"/api/image",
post(documents::image::post).get(documents::image::get),
)
.route("/api/sunrise", post(documents::sunrise::post))
.route("/api/text", post(documents::text::post))
.route("/api/tictactoe", post(documents::tictactoe::post))