Notify user whether uploaded images are saved
This commit is contained in:
parent
dad0f282c6
commit
8b0b07a367
3 changed files with 58 additions and 4 deletions
|
|
@ -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(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue