use axum::http::{StatusCode, header};
use axum::response::{IntoResponse, Response};
use rust_embed::RustEmbed;
#[derive(RustEmbed)]
#[folder = "assets/"]
pub struct StudioAssets;
pub async fn serve_asset(path: &str) -> Response {
match StudioAssets::get(path) {
Some(content) => {
let mime = mime_guess::from_path(path).first_or_octet_stream();
(
StatusCode::OK,
[(header::CONTENT_TYPE, mime.as_ref())],
content.data,
)
.into_response()
}
None => (StatusCode::NOT_FOUND, "Asset not found").into_response(),
}
}