fix: add /api/v1/face-thumbnail route for People view thumbnails
- Frontend calls /api/v1/face-thumbnail?uuid=...&frame=... - Backend only had /api/v1/file/:file_uuid/thumbnail - Added compat route and uuid field to ThumbQuery
This commit is contained in:
@@ -51,6 +51,7 @@ fn ffmpeg_cmd() -> std::process::Command {
|
|||||||
|
|
||||||
pub fn bbox_routes() -> Router<crate::api::types::AppState> {
|
pub fn bbox_routes() -> Router<crate::api::types::AppState> {
|
||||||
Router::new()
|
Router::new()
|
||||||
|
.route("/api/v1/face-thumbnail", get(face_thumbnail_compat))
|
||||||
.route(
|
.route(
|
||||||
"/api/v1/file/:file_uuid/video/bbox",
|
"/api/v1/file/:file_uuid/video/bbox",
|
||||||
get(bbox_overlay_video),
|
get(bbox_overlay_video),
|
||||||
@@ -768,6 +769,7 @@ async fn stream_video(
|
|||||||
|
|
||||||
#[derive(Debug, serde::Deserialize)]
|
#[derive(Debug, serde::Deserialize)]
|
||||||
struct ThumbQuery {
|
struct ThumbQuery {
|
||||||
|
uuid: Option<String>,
|
||||||
frame: Option<i64>,
|
frame: Option<i64>,
|
||||||
x: Option<i32>,
|
x: Option<i32>,
|
||||||
y: Option<i32>,
|
y: Option<i32>,
|
||||||
@@ -776,6 +778,14 @@ struct ThumbQuery {
|
|||||||
trace_id: Option<i32>,
|
trace_id: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn face_thumbnail_compat(
|
||||||
|
State(state): State<crate::api::types::AppState>,
|
||||||
|
Query(q): Query<ThumbQuery>,
|
||||||
|
) -> Result<impl IntoResponse, StatusCode> {
|
||||||
|
let file_uuid = q.uuid.clone().ok_or(StatusCode::BAD_REQUEST)?;
|
||||||
|
face_thumbnail(State(state), Path(file_uuid), Query(q)).await
|
||||||
|
}
|
||||||
|
|
||||||
async fn face_thumbnail(
|
async fn face_thumbnail(
|
||||||
State(state): State<crate::api::types::AppState>,
|
State(state): State<crate::api::types::AppState>,
|
||||||
Path(file_uuid): Path<String>,
|
Path(file_uuid): Path<String>,
|
||||||
@@ -1266,6 +1276,7 @@ async fn media_proxy_handler(
|
|||||||
match type_ {
|
match type_ {
|
||||||
"thumbnail" => {
|
"thumbnail" => {
|
||||||
let thumb_query = ThumbQuery {
|
let thumb_query = ThumbQuery {
|
||||||
|
uuid: None,
|
||||||
frame: params.get("frame").and_then(|v| v.parse().ok()),
|
frame: params.get("frame").and_then(|v| v.parse().ok()),
|
||||||
x: params.get("x").and_then(|v| v.parse().ok()),
|
x: params.get("x").and_then(|v| v.parse().ok()),
|
||||||
y: params.get("y").and_then(|v| v.parse().ok()),
|
y: params.get("y").and_then(|v| v.parse().ok()),
|
||||||
|
|||||||
Reference in New Issue
Block a user