1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use crate::{request_info::RequestInfo, ui::error::MyResult};
use rocket::{get, response::Redirect};
#[get("/watch?<v>")]
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(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(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!()
}
|