Added in some display for the node_info

And cleaned up a couple of things.
Started on the pretty printing of some of the Monerod stuff
This commit is contained in:
2024-05-26 16:35:08 +01:00
parent e04351ca3d
commit 39cfdbfe4c
3 changed files with 47 additions and 8 deletions

View File

@@ -100,12 +100,11 @@ fn get_node_info() -> NodeInfoInner {
let node_info = task::block_in_place(move || {
let client = reqwest::blocking::Client::new();
// TODO: Properly handle this unwrap - half the point of this is to capture
// when the node is down
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
// TODO: Make this resp.json - I need to build a deserializer I think
// TODO: Figure out _why_ this part needs to be inside this closure
resp.json::<NodeInfo>()
// TODO: Properly handle this unwrap - half the point of this is to capture
// when the node is down
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
// TODO: Figure out _why_ this part needs to be inside this closure
resp.json::<NodeInfo>()
}).unwrap();
node_info.result
}

View File

@@ -51,5 +51,15 @@ pub struct NodeInfoInner {
was_bootstrap_ever_used: bool,
white_peerlist_size: u64,
wide_cumulative_difficulty: String,
wide_difficulty: String
wide_difficulty: String,
#[serde(skip_deserializing, default = "none")]
time_up_pretty: Option<String>,
#[serde(skip_deserializing, default = "none")]
space_left_pretty: Option<String>,
#[serde(skip_deserializing, default = "none")]
db_size_pretty: Option<String>,
}
fn none() -> Option<String> {
None
}