aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-01-23 04:19:24 +0100
committermetamuffin <metamuffin@disroot.org>2026-01-23 04:19:24 +0100
commit3671a4e07565c86f8071fb2309f463aeaf684ba3 (patch)
tree9a9057c7dcc174ada17a45a195502ff94b2f2946 /common
parent10cdaaa30a6b4a187797434dc8d959780f0e8fbf (diff)
downloadjellything-3671a4e07565c86f8071fb2309f463aeaf684ba3.tar
jellything-3671a4e07565c86f8071fb2309f463aeaf684ba3.tar.bz2
jellything-3671a4e07565c86f8071fb2309f463aeaf684ba3.tar.zst
move ui code around
Diffstat (limited to 'common')
-rw-r--r--common/object/src/registry.rs6
-rw-r--r--common/src/api.rs17
-rw-r--r--common/src/routes.rs4
3 files changed, 21 insertions, 6 deletions
diff --git a/common/object/src/registry.rs b/common/object/src/registry.rs
index 2cd2a1f..d9da2fb 100644
--- a/common/object/src/registry.rs
+++ b/common/object/src/registry.rs
@@ -34,10 +34,10 @@ impl Registry {
pub fn info(&self, tag: Tag) -> Option<&TagInfo> {
self.tags.get(&tag)
}
- pub fn name(&self, tag: Tag) -> String {
+ pub fn name(&self, tag: Tag) -> &str {
match self.tags.get(&tag) {
- Some(inf) => inf.name.to_string(),
- None => format!("unknown_tag_{:04x}", tag.0),
+ Some(inf) => inf.name,
+ None => "unknown",
}
}
}
diff --git a/common/src/api.rs b/common/src/api.rs
index 2123477..ee26020 100644
--- a/common/src/api.rs
+++ b/common/src/api.rs
@@ -14,10 +14,12 @@ fields! {
QUERY_SORT_ASCENDING: () = 2003 "sort_ascending";
VIEW_TITLE: &str = 2005 "title";
- VIEW_MESSAGE: &str = 2010 "message";
+ 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";
NKU_NODE: Object = 2025 "node";
NKU_UDATA: Object = 2026 "udata";
@@ -26,6 +28,19 @@ fields! {
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! {
diff --git a/common/src/routes.rs b/common/src/routes.rs
index 48f975a..1d3a8da 100644
--- a/common/src/routes.rs
+++ b/common/src/routes.rs
@@ -18,8 +18,8 @@ pub fn u_node_slug_player(node: &str) -> String {
pub fn u_node_slug_player_time(node: &str, time: f64) -> String {
format!("/n/{node}/player?t={time}")
}
-pub fn u_node_image(node: &str, slot: &str, size: usize) -> String {
- format!("/n/{node}/image/{slot}?size={size}")
+pub fn u_image(path: &str, size: usize) -> String {
+ format!("/image/{path}?size={size}")
}
pub fn u_node_slug_watched(node: &str, state: &str) -> String {
format!("/n/{node}/watched?state={state}")