MCPcopy Create free account
hub / github.com/3eif/gitmotion / serve_video

Function serve_video

api/src/main.rs:707–718  ·  view source on GitHub ↗
(req: HttpRequest, job_id: web::Path<String>)

Source from the content-addressed store, hash-verified

705}
706
707async fn serve_video(req: HttpRequest, job_id: web::Path<String>) -> Result<HttpResponse> {
708 let video_path = PathBuf::from(format!("/gource_videos/gource_{}.mp4", job_id));
709 if video_path.exists() {
710 Ok(NamedFile::open(video_path)?
711 .set_content_type(mime::APPLICATION_OCTET_STREAM)
712 .into_response(&req))
713 } else {
714 Ok(HttpResponse::NotFound().json(serde_json::json!({
715 "error": "Video not found"
716 })))
717 }
718}
719
720async fn clear_gource_videos(job_store: web::Data<JobStore>) {
721 let path = Path::new("/gource_videos");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected