From 3671a4e07565c86f8071fb2309f463aeaf684ba3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 23 Jan 2026 04:19:24 +0100 Subject: move ui code around --- common/object/src/registry.rs | 6 +++--- common/src/api.rs | 17 ++++++++++++++++- common/src/routes.rs | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'common') 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}") -- cgit v1.3