feat(nip-86): add uptime, fix numconnections name.

This commit is contained in:
Kay 2025-01-30 20:02:35 +00:00
parent 761dc6ce90
commit 46f5bb713a

View File

@ -106,7 +106,8 @@ pub fn handle_inner(command: Value) -> Result<Option<Value>, Error> {
"listbannedevents",
"listbannedpubkeys",
"supportedmethods",
"liveconnections"
"numconnections",
"uptime"
]
}))),
@ -216,13 +217,20 @@ pub fn handle_inner(command: Value) -> Result<Option<Value>, 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()),
}
}