aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-11-30 15:47:20 +0100
committermetamuffin <metamuffin@disroot.org>2025-11-30 15:47:20 +0100
commite4584a8135584e6591bac7d5397cf227cf3cff92 (patch)
tree5f3c2bdd19bbad2a9358f8de2de7f5b6c2846ed8 /server
parent8174d129fbabd2d39323678d11d868893ddb429a (diff)
downloadjellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar
jellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar.bz2
jellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar.zst
eid fixes
Diffstat (limited to 'server')
-rw-r--r--server/src/compat/youtube.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/src/compat/youtube.rs b/server/src/compat/youtube.rs
index 7126781..5bbcf77 100644
--- a/server/src/compat/youtube.rs
+++ b/server/src/compat/youtube.rs
@@ -5,7 +5,10 @@
*/
use crate::{helper::A, ui::error::MyResult};
use anyhow::anyhow;
-use jellycommon::routes::{u_node_slug, u_node_slug_player};
+use jellycommon::{
+ routes::{u_node_slug, u_node_slug_player},
+ IdentifierType,
+};
use jellylogic::{
node::{get_node_by_eid, node_id_to_slug},
session::Session,
@@ -17,7 +20,7 @@ pub fn r_youtube_watch(session: A<Session>, v: &str) -> MyResult<Redirect> {
if v.len() != 11 {
Err(anyhow!("video id length incorrect"))?
}
- let Some(id) = get_node_by_eid(&session.0, "youtube:video", v)? else {
+ let Some(id) = get_node_by_eid(&session.0, IdentifierType::YoutubeVideo, v)? else {
Err(anyhow!("element not found"))?
};
let slug = node_id_to_slug(&session.0, id)?;
@@ -27,9 +30,9 @@ pub fn r_youtube_watch(session: A<Session>, v: &str) -> MyResult<Redirect> {
#[get("/channel/<id>")]
pub fn r_youtube_channel(session: A<Session>, id: &str) -> MyResult<Redirect> {
let Some(id) = (if id.starts_with("UC") {
- get_node_by_eid(&session.0, "youtube:channel", id)?
+ get_node_by_eid(&session.0, IdentifierType::YoutubeChannel, id)?
} else if id.starts_with("@") {
- get_node_by_eid(&session.0, "youtube:channel-name", id)?
+ get_node_by_eid(&session.0, IdentifierType::YoutubeChannelHandle, id)?
} else {
Err(anyhow!("unknown channel id format"))?
}) else {
@@ -44,7 +47,7 @@ pub fn r_youtube_embed(session: A<Session>, v: &str) -> MyResult<Redirect> {
if v.len() != 11 {
Err(anyhow!("video id length incorrect"))?
}
- let Some(id) = get_node_by_eid(&session.0, "youtube:video", v)? else {
+ let Some(id) = get_node_by_eid(&session.0, IdentifierType::YoutubeVideo, v)? else {
Err(anyhow!("element not found"))?
};
let slug = node_id_to_slug(&session.0, id)?;