From 46f5bb713a50b8b1a794905d6fccd55f0747092d Mon Sep 17 00:00:00 2001 From: Kay Date: Thu, 30 Jan 2025 20:02:35 +0000 Subject: [PATCH] feat(nip-86): add uptime, fix numconnections name. --- src/web/management/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/web/management/mod.rs b/src/web/management/mod.rs index 23994cf..25dff20 100644 --- a/src/web/management/mod.rs +++ b/src/web/management/mod.rs @@ -106,7 +106,8 @@ pub fn handle_inner(command: Value) -> Result, Error> { "listbannedevents", "listbannedpubkeys", "supportedmethods", - "liveconnections" + "numconnections", + "uptime" ] }))), @@ -216,13 +217,20 @@ pub fn handle_inner(command: Value) -> Result, Error> { "changerelayicon" => Err(ChorusError::NotImplemented.into()), // System - "liveconnections" => { + "numconnections" => { let num = &GLOBALS.num_connections; Ok(Some(json!({ "result": num, }))) } + "uptime" => { + let uptime_in_secs = GLOBALS.start_time.elapsed().as_secs(); + Ok(Some(json!({ + "result": uptime_in_secs, + }))) + } + _ => Err(ChorusError::NotImplemented.into()), } }