pinakes-server: relativize media paths against configured root directories
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I9f113e6402030c46ad97f636985b5d6c6a6a6964
This commit is contained in:
parent
5077e9f117
commit
9c67c81a79
11 changed files with 212 additions and 42 deletions
|
|
@ -51,9 +51,14 @@ pub async fn search(
|
|||
};
|
||||
|
||||
let results = state.storage.search(&request).await?;
|
||||
let roots = state.config.read().await.directories.roots.clone();
|
||||
|
||||
Ok(Json(SearchResponse {
|
||||
items: results.items.into_iter().map(MediaResponse::from).collect(),
|
||||
items: results
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| MediaResponse::new(item, &roots))
|
||||
.collect(),
|
||||
total_count: results.total_count,
|
||||
}))
|
||||
}
|
||||
|
|
@ -84,9 +89,14 @@ pub async fn search_post(
|
|||
};
|
||||
|
||||
let results = state.storage.search(&request).await?;
|
||||
let roots = state.config.read().await.directories.roots.clone();
|
||||
|
||||
Ok(Json(SearchResponse {
|
||||
items: results.items.into_iter().map(MediaResponse::from).collect(),
|
||||
items: results
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| MediaResponse::new(item, &roots))
|
||||
.collect(),
|
||||
total_count: results.total_count,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue