Merge pull request #40 from kehiy/feature/nip-86

feat(nip-86): add uptime, fix numconnections name.
This commit is contained in:
Michael Dilger 2025-01-31 15:08:14 +13:00 committed by GitHub
commit b06497e53b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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()),
}
}