diff --git a/src/main.rs b/src/main.rs index 5a3dfe4..45678e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -143,25 +143,14 @@ async fn main() -> Result<(), Box> { async fn index() -> Html<&'static str> { Html(INDEX_HTML) } async fn tools_page() -> Html<&'static str> { Html(TOOLS_HTML) } -/// Health check: tests camera access right now. Camera must be reachable. +/// Health check: lightweight probe — confirms the server is running. +/// Actual camera availability is tested on every /random request. async fn health() -> Response { - let config = CameraConfig::from_env(); - let result = tokio::task::spawn_blocking(move || test_camera(&config)).await; - let body = match result { - Ok(Ok((w, h, frame_size))) => serde_json::json!({ - "status": "ok", - "camera": format!("{}x{}", w, h), - "frame_bytes": frame_size, - }), - Ok(Err(e)) => serde_json::json!({ - "status": "error", - "error": e, - }), - Err(e) => serde_json::json!({ - "status": "error", - "error": e.to_string(), - }), - }; + let body = serde_json::json!({ + "status": "ok", + "mode": "live", + "note": "Camera is opened on each request. Hit /random to test live capture.", + }); Response::builder() .header(header::CONTENT_TYPE, "application/json") .body(Body::from(body.to_string()))