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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
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 jellyobject::{Object, Tag, enums, fields};
fields! {
QUERY_PARENT: u64 = 2000 "parent";
QUERY_SEARCH: &str = 2001 "search";
QUERY_KIND: Tag = 2004 "kind"; // multi
QUERY_SORT: Tag = 2002 "sort"; // one of RTYP_*, NU_RATING, NO_DURATION, NO_NAME
QUERY_SORT_ASCENDING: () = 2003 "sort_ascending";
VIEW_TITLE: &str = 2005 "title";
VIEW_MESSAGE: Object = 2010 "message";
VIEW_NODE_PAGE: Object = 2011 "node_page";
VIEW_NODE_LIST: Object = 2012 "node_list"; // multi
VIEW_PLAYER: u64 = 2028 "player";
VIEW_STATGROUP: Object = 2041 "statgroup";
VIEW_STATTEXT: Object = 2042 "stattext";
VIEW_ACCOUNT_LOGIN: () = 2043 "account_login";
VIEW_ACCOUNT_LOGOUT: () = 2044 "account_logout";
VIEW_ACCOUNT_SET_PASSWORD: &str = 2045 "account_set_password";
VIEW_ADMIN_DASHBOARD: () = 2046 "admin_dashboard";
VIEW_ADMIN_IMPORT: Object = 2047 "admin_import";
ADMIN_IMPORT_BUSY: () = 2048 "busy";
ADMIN_IMPORT_ERROR: &str = 2049 "error"; // multi
NKU_NODE: Object = 2025 "node";
NKU_UDATA: Object = 2026 "udata";
NKU_ROLE: &str = 2027 "role";
NODELIST_TITLE: &str = 2007 "title";
NODELIST_DISPLAYSTYLE: &str = 2008 "displaystyle";
NODELIST_ITEM: &str = 2009 "item";
MESSAGE_KIND: &str = 2029 "kind";
MESSAGE_TEXT: &str = 2030 "text";
STATGROUP_TITLE: &str = 2039 "title";
STATGROUP_BIN: Object = 2040 "bin";
STAT_NAME: &str = 2038 "name";
STAT_COUNT: u64 = 2031 "count";
STAT_TOTAL_SIZE: u64 = 2032 "total_size";
STAT_TOTAL_DURATION: f64 = 2033 "total_duration";
STAT_MAX_SIZE: u64 = 2036 "max_size";
STAT_MAX_DURATION: f64 = 2037 "max_duration";
}
enums! {
NLSTYLE_GRID = 1023 "grid";
NLSTYLE_INLINE = 1024 "inline";
NLSTYLE_LIST = 1025 "list";
}
// use crate::user::{NodeUserData, User};
// use std::{collections::BTreeMap, sync::Arc, time::Duration};
// pub struct ApiNodeResponse {
// pub parents: NodesWithUdata,
// pub children: NodesWithUdata,
// pub node: Arc<Node>,
// pub userdata: NodeUserData,
// }
// pub struct ApiSearchResponse {
// pub count: usize,
// pub results: NodesWithUdata,
// pub duration: Duration,
// }
// pub struct ApiItemsResponse {
// pub count: usize,
// pub pages: usize,
// pub items: NodesWithUdata,
// }
// pub struct ApiHomeResponse {
// pub toplevel: NodesWithUdata,
// pub categories: Vec<(String, NodesWithUdata)>,
// }
// pub struct ApiStatsResponse {
// pub kinds: BTreeMap<NodeKind, StatsBin>,
// pub total: StatsBin,
// }
// pub struct ApiAdminUsersResponse {
// pub users: Vec<User>,
// }
// #[derive(Default, Serialize, Deserialize)]
// pub struct StatsBin {
// pub runtime: f64,
// pub size: u64,
// pub count: usize,
// pub max_runtime: f64,
// pub max_runtime_node: String,
// pub max_size: u64,
// pub max_size_node: String,
// }
|