aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/player.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/ui/player.rs')
-rw-r--r--server/src/routes/ui/player.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/server/src/routes/ui/player.rs b/server/src/routes/ui/player.rs
index b24e5e9..f680a45 100644
--- a/server/src/routes/ui/player.rs
+++ b/server/src/routes/ui/player.rs
@@ -20,7 +20,7 @@ use jellybase::{permission::PermissionSetExt, CONF};
use jellycommon::{
stream::{StreamFormat, StreamSpec},
user::{PermissionSet, PlayerKind, UserPermission},
- Node, SourceTrackKind, TrackID,
+ Node, NodeID, SourceTrackKind, TrackID,
};
use markup::DynRender;
use rocket::{get, response::Redirect, Either, FromForm, State, UriDisplayQuery};
@@ -61,12 +61,10 @@ fn jellynative_url(action: &str, seek: f64, secret: &str, node: &str, session: &
pub fn r_player<'a>(
sess: Session,
db: &'a State<Database>,
- id: &'a str,
+ id: NodeID,
conf: PlayerConfig,
) -> MyResult<Either<DynLayoutPage<'a>, Redirect>> {
- let item = db
- .get_node_slug(id)?
- .ok_or(anyhow!("node does not exist"))?;
+ let node = db.get_node(id)?.ok_or(anyhow!("node does not exist"))?;
let native_session = |action: &str| {
let perm = [
@@ -81,7 +79,7 @@ pub fn r_player<'a>(
action,
conf.t.unwrap_or(0.),
&sess.user.native_secret,
- id,
+ &id.to_string(),
&token::create(
sess.user.name,
PermissionSet(perm.map(|e| (e, true)).into()),
@@ -114,15 +112,15 @@ pub fn r_player<'a>(
let playing = !spec.track.is_empty();
- let conf = player_conf(item.clone(), playing)?;
+ let conf = player_conf(node.clone(), playing)?;
Ok(Either::Left(LayoutPage {
- title: item.title.to_owned().unwrap_or_default(),
+ title: node.title.to_owned().unwrap_or_default(),
class: Some("player"),
content: markup::new! {
@if playing {
- video[src=uri!(r_stream(&id, &spec)), controls, preload="auto"]{}
+ video[src=uri!(r_stream(&node.slug, &spec)), controls, preload="auto"]{}
} else {
- img.backdrop[src=uri!(r_item_backdrop(&id, Some(2048))).to_string()];
+ img.backdrop[src=uri!(r_item_backdrop(&node.slug, Some(2048))).to_string()];
}
@conf
},