aboutsummaryrefslogtreecommitdiff
path: root/common/src/routes.rs
blob: 9472c85c0babbd570c0cc5169dcc2f660c903e81 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
    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) 2025 metamuffin <metamuffin.org>
*/
use crate::{api::NodeFilterSort, user::ApiWatchedState, NodeID, PeopleGroup};

pub fn u_home() -> String {
    "/home".to_owned()
}
pub fn u_node_id(node: NodeID) -> String {
    format!("/n/{node}")
}
pub fn u_node_slug(node: &str) -> String {
    format!("/n/{node}")
}
pub fn u_node_slug_player(node: &str) -> String {
    format!("/n/{node}/player")
}
pub fn u_node_slug_player_time(node: &str, time: f64) -> String {
    format!("/n/{node}/player?t={time}")
}
pub fn u_node_slug_poster(node: &str, width: usize) -> String {
    format!("/n/{node}/poster?width={width}")
}
pub fn u_node_slug_backdrop(node: &str, width: usize) -> String {
    format!("/n/{node}/backdrop?width={width}")
}
pub fn u_node_slug_watched(node: &str, state: ApiWatchedState) -> String {
    format!("/n/{node}/watched?state={state}")
}
pub fn u_node_slug_person_asset(
    node: &str,
    group: PeopleGroup,
    index: usize,
    width: usize,
) -> String {
    format!("/n/{node}/person/{index}/asset?group={group}&width={width}")
}
pub fn u_node_slug_thumbnail(node: &str, time: f64, width: usize) -> String {
    format!("/n/{node}/thumbnail?t={time}&width={width}")
}
pub fn u_node_slug_update_rating(node: &str) -> String {
    format!("/n/{node}/update_rating")
}
pub fn u_node_slug_progress(node: &str, time: f64) -> String {
    format!("/n/{node}/progress?t={time}")
}
pub fn u_items() -> String {
    format!("/items")
}
pub fn u_items_filter(page: usize, _filter: &NodeFilterSort) -> String {
    // TODO
    format!("/items?page={page}")
}
pub fn u_admin_users() -> String {
    format!("/admin/users")
}
pub fn u_admin_user(name: &str) -> String {
    format!("/admin/user/{name}")
}
pub fn u_admin_user_permission(name: &str) -> String {
    format!("/admin/user/{name}/update_permissions")
}
pub fn u_admin_user_remove(name: &str) -> String {
    format!("/admin/user/{name}/remove")
}
pub fn u_account_register() -> String {
    "/account/register".to_owned()
}
pub fn u_account_login() -> String {
    "/account/login".to_owned()
}
pub fn u_account_logout() -> String {
    "/account/logout".to_owned()
}
pub fn u_admin_dashboard() -> String {
    "/admin/dashboard".to_owned()
}
pub fn u_account_settings() -> String {
    "/account/settings".to_owned()
}
pub fn u_stats() -> String {
    "/stats".to_owned()
}
pub fn u_search() -> String {
    "/search".to_owned()
}