diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-25 23:32:53 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-25 23:32:53 +0100 |
| commit | 783d3598753bf84756296a2016e5dab30300519b (patch) | |
| tree | f7eaf276b65de8aab10db21d27e534f775d83167 /server/src/compat | |
| parent | 5075aede44cb8ab2df10e6debba38483e8d11e96 (diff) | |
| download | jellything-783d3598753bf84756296a2016e5dab30300519b.tar jellything-783d3598753bf84756296a2016e5dab30300519b.tar.bz2 jellything-783d3598753bf84756296a2016e5dab30300519b.tar.zst | |
work on login
Diffstat (limited to 'server/src/compat')
| -rw-r--r-- | server/src/compat/youtube.rs | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/server/src/compat/youtube.rs b/server/src/compat/youtube.rs index 5e86014..e511d9b 100644 --- a/server/src/compat/youtube.rs +++ b/server/src/compat/youtube.rs @@ -3,53 +3,47 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin <metamuffin.org> */ -use crate::{request_info::A, ui::error::MyResult}; -use anyhow::anyhow; -use jellycommon::{ - routes::{u_node_slug, u_node_slug_player}, - IdentifierType, -}; -use jellylogic::{ - node::{get_node_by_eid, node_id_to_slug}, - session::Session, -}; +use crate::{request_info::RequestInfo, ui::error::MyResult}; use rocket::{get, response::Redirect}; #[get("/watch?<v>")] -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, IdentifierType::YoutubeVideo, v)? else { - Err(anyhow!("element not found"))? - }; - let slug = node_id_to_slug(&session.0, id)?; - Ok(Redirect::to(u_node_slug_player(&slug))) +pub fn r_youtube_watch(ri: RequestInfo<'_>, v: &str) -> MyResult<Redirect> { + // if v.len() != 11 { + // Err(anyhow!("video id length incorrect"))? + // } + // 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)?; + // Ok(Redirect::to(u_node_slug_player(&slug))) + todo!() } #[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, IdentifierType::YoutubeChannel, id)? - } else if id.starts_with("@") { - get_node_by_eid(&session.0, IdentifierType::YoutubeChannelHandle, id)? - } else { - Err(anyhow!("unknown channel id format"))? - }) else { - Err(anyhow!("channel not found"))? - }; - let slug = node_id_to_slug(&session.0, id)?; - Ok(Redirect::to(u_node_slug(&slug))) +pub fn r_youtube_channel(ri: RequestInfo<'_>, id: &str) -> MyResult<Redirect> { + // let Some(id) = (if id.starts_with("UC") { + // get_node_by_eid(&session.0, IdentifierType::YoutubeChannel, id)? + // } else if id.starts_with("@") { + // get_node_by_eid(&session.0, IdentifierType::YoutubeChannelHandle, id)? + // } else { + // Err(anyhow!("unknown channel id format"))? + // }) else { + // Err(anyhow!("channel not found"))? + // }; + // let slug = node_id_to_slug(&session.0, id)?; + // Ok(Redirect::to(u_node_slug(&slug))) + todo!() } #[get("/embed/<v>")] -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, IdentifierType::YoutubeVideo, v)? else { - Err(anyhow!("element not found"))? - }; - let slug = node_id_to_slug(&session.0, id)?; - Ok(Redirect::to(u_node_slug_player(&slug))) +pub fn r_youtube_embed(ri: RequestInfo<'_>, v: &str) -> MyResult<Redirect> { + // if v.len() != 11 { + // Err(anyhow!("video id length incorrect"))? + // } + // 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)?; + // Ok(Redirect::to(u_node_slug_player(&slug))) + todo!() } |