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
50
51
52
53
54
55
56
57
58
59
|
/*
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 rocket::{FromFormField, UriDisplayQuery};
#[derive(Debug, FromFormField, UriDisplayQuery)]
pub enum UrlWatchedState {
None,
Watched,
Pending,
}
// #[get("/n/<id>/userdata")]
// pub fn r_node_userdata(session: A<Session>, id: A<NodeID>) -> MyResult<Json<NodeUserData>> {
// let u = get_node(&session.0, id.0, false, false, NodeFilterSort::default())?.userdata;
// Ok(Json(u))
// }
// #[post("/n/<id>/watched?<state>")]
// pub async fn r_node_userdata_watched(
// session: A<Session>,
// id: A<NodeID>,
// state: UrlWatchedState,
// ) -> MyResult<Redirect> {
// update_node_userdata_watched(
// &session.0,
// id.0,
// match state {
// UrlWatchedState::None => WatchedState::None,
// UrlWatchedState::Watched => WatchedState::Watched,
// UrlWatchedState::Pending => WatchedState::Pending,
// },
// )?;
// Ok(Redirect::found(u_node_id(id.0)))
// }
// #[derive(FromForm)]
// pub struct UpdateRating {
// #[field(validate = range(-10..=10))]
// rating: i32,
// }
// #[post("/n/<id>/update_rating", data = "<form>")]
// pub async fn r_node_userdata_rating(
// session: A<Session>,
// id: A<NodeID>,
// form: Form<UpdateRating>,
// ) -> MyResult<Redirect> {
// update_node_userdata_rating(&session.0, id.0, form.rating)?;
// Ok(Redirect::found(u_node_id(id.0)))
// }
// #[post("/n/<id>/progress?<t>")]
// pub async fn r_node_userdata_progress(session: A<Session>, id: A<NodeID>, t: f64) -> MyResult<()> {
// update_node_userdata_watched_progress(&session.0, id.0, t)?;
// Ok(())
// }
|