aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/routes/ui/assets.rs2
-rw-r--r--server/src/routes/ui/browser.rs27
2 files changed, 20 insertions, 9 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs
index 2c0b85a..27d322a 100644
--- a/server/src/routes/ui/assets.rs
+++ b/server/src/routes/ui/assets.rs
@@ -28,7 +28,7 @@ pub async fn r_item_assets(
db: &State<Database>,
) -> Result<(ContentType, CacheControlFile), MyError> {
let node = db.node.get(&id)?.ok_or(anyhow!("node does not exist"))?;
- let path = CONF.asset_path.join(
+ let path = CONF.library_path.join(
match role {
AssetRole::Backdrop => node.private.backdrop,
AssetRole::Poster => node.private.poster,
diff --git a/server/src/routes/ui/browser.rs b/server/src/routes/ui/browser.rs
index 767e411..e7f7d96 100644
--- a/server/src/routes/ui/browser.rs
+++ b/server/src/routes/ui/browser.rs
@@ -3,24 +3,35 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use super::{account::session::Session, error::MyError, layout::DynLayoutPage};
+use super::{account::session::Session, error::MyError, layout::DynLayoutPage, node::PosterCard};
use crate::database::Database;
+use anyhow::Context;
+use jellycommon::{Node, NodeKind};
use rocket::{get, State};
#[get("/items")]
pub fn r_all_items(_sess: Session, db: &State<Database>) -> Result<DynLayoutPage<'_>, MyError> {
+ let items = db
+ .node
+ .iter()
+ .map(|e| e.context("listing"))
+ .collect::<anyhow::Result<Vec<_>>>()?
+ .into_iter()
+ .filter(|(_, n)| matches!(n.public.kind, NodeKind::Movie | NodeKind::Series))
+ .collect::<Vec<(String, Node)>>();
+
Ok(super::layout::LayoutPage {
title: "All Items".to_owned(),
content: markup::new! {
.page.dir {
h1 { "All Items" }
- // ul.directorylisting { @for item in &items {
- // li {@PosterCard {
- // wide: false, dir: false,
- // path: item.lib_path.clone(),
- // title: &item.info.title
- // }}
- // }}
+ ul.directorylisting { @for (id, node) in &items {
+ li {@PosterCard {
+ wide: false, dir: false,
+ id,
+ title: &node.public.title
+ }}
+ }}
}
},
..Default::default()