diff --git a/service/src/main.rs b/service/src/main.rs index 99f9aaa..0e493e2 100644 --- a/service/src/main.rs +++ b/service/src/main.rs @@ -5,7 +5,7 @@ use rocket::fs::FileServer; mod video; mod db; -const FILES_ROOT: &'static str = "/opt/clippable"; +const FILES_VIDEO: &'static str = "/opt/clippable/file/video"; const DB_FILE: &'static str = "/opt/clippable/db.json"; const VIDEO_BASE_URI: &'static str = "/file/video"; diff --git a/service/src/video.rs b/service/src/video.rs index 814f721..cf6555f 100644 --- a/service/src/video.rs +++ b/service/src/video.rs @@ -1,5 +1,5 @@ -use crate::{FILES_ROOT, VIDEO_BASE_URI, db}; -use std::path::{Path, PathBuf}; +use crate::{FILES_VIDEO, VIDEO_BASE_URI, db}; +use std::path::PathBuf; use rocket::fs::NamedFile; use rocket_dyn_templates::{Template, context}; @@ -25,8 +25,7 @@ pub fn index(video_id: &str) -> Template { #[get("/")] pub async fn file(path: PathBuf) -> Option { - let mut disk = Path::new(FILES_ROOT).join(VIDEO_BASE_URI); - disk.push(path); + let disk = PathBuf::from(FILES_VIDEO).join(path); println!("disk path: {disk:?}"); NamedFile::open(disk).await.ok()