mirror of
https://github.com/mikedilger/chorus.git
synced 2026-01-03 06:15:33 +00:00
add live conns to managment api + fixing header value.
This commit is contained in:
parent
2340085832
commit
1ebefba20f
@ -18,7 +18,7 @@ fn respond(
|
||||
.header("Access-Control-Allow-Origin", "*")
|
||||
.header("Access-Control-Allow-Headers", "*")
|
||||
.header("Access-Control-Allow-Methods", "*")
|
||||
.header("Content-Type", "application/nostr+json")
|
||||
.header("Content-Type", "application/nostr+json+rpc")
|
||||
.status(status)
|
||||
.body(
|
||||
Full::new(s.into_bytes().into())
|
||||
@ -105,7 +105,8 @@ pub fn handle_inner(command: Value) -> Result<Option<Value>, Error> {
|
||||
"listallowedpubkeys",
|
||||
"listbannedevents",
|
||||
"listbannedpubkeys",
|
||||
"supportedmethods"
|
||||
"supportedmethods",
|
||||
"liveconnections"
|
||||
]
|
||||
}))),
|
||||
|
||||
@ -214,6 +215,14 @@ pub fn handle_inner(command: Value) -> Result<Option<Value>, Error> {
|
||||
"changerelaydescription" => Err(ChorusError::NotImplemented.into()),
|
||||
"changerelayicon" => Err(ChorusError::NotImplemented.into()),
|
||||
|
||||
// System
|
||||
"liveconnections" => {
|
||||
let num = &GLOBALS.num_connections;
|
||||
Ok(Some(json!({
|
||||
"result": num,
|
||||
})))
|
||||
}
|
||||
|
||||
_ => Err(ChorusError::NotImplemented.into()),
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user