2024-07-24 14:43:09 +00:00
|
|
|
use axum::{extract::State, http::StatusCode, routing::post, Router};
|
2024-07-18 12:34:28 +00:00
|
|
|
|
2024-07-24 14:43:09 +00:00
|
|
|
use crate::display::Wrapper;
|
|
|
|
use std::sync::{Arc, Mutex};
|
2024-07-18 12:34:28 +00:00
|
|
|
|
2024-07-24 14:43:09 +00:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
struct ApiContext {
|
|
|
|
display: Arc<Mutex<Wrapper>>,
|
|
|
|
}
|
2024-07-18 12:34:28 +00:00
|
|
|
/// API routes for axum
|
|
|
|
/// Start with the basics: Send an image, crop it, dither, and upload.
|
|
|
|
/// we defer the upload to a separate task.
|
2024-07-24 14:43:09 +00:00
|
|
|
pub fn router() -> Router<ApiContext> {
|
|
|
|
Router::new()
|
|
|
|
.route("/setimage", post(set_image))
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn set_image(State(ctx): State<ApiContext>) {
|
|
|
|
}
|
2024-07-18 12:34:28 +00:00
|
|
|
|