mirror of
https://github.com/mikedilger/chorus.git
synced 2026-01-03 06:15:33 +00:00
Merge pull request #40 from kehiy/feature/nip-86
feat(nip-86): add uptime, fix numconnections name.
This commit is contained in:
commit
b06497e53b
@ -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()),
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user