From ba0c50c170a63b5f5e5d0f0e68d19c3f25c846eb Mon Sep 17 00:00:00 2001 From: creating2morrow Date: Thu, 18 May 2023 02:12:28 -0400 Subject: [PATCH] revert i2p status check back to json --- nevmes-core/src/i2p.rs | 1 + src/controller.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nevmes-core/src/i2p.rs b/nevmes-core/src/i2p.rs index 6b0ac77..00f30c9 100644 --- a/nevmes-core/src/i2p.rs +++ b/nevmes-core/src/i2p.rs @@ -137,6 +137,7 @@ fn get_i2p_proxy_port() -> String { let port = v.remove(2); port } + /// Create the http proxy if it doesn't exist fn create_http_proxy() { let args = args::Args::parse(); diff --git a/src/controller.rs b/src/controller.rs index 76ac705..49ac55a 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -34,8 +34,13 @@ pub async fn get_version(_jwp: proof::PaymentProof) -> Custom Custom> { - Custom(Status::Ok, Json(i2p::check_connection().await)) +pub async fn get_i2p_status() -> Custom> { + let status: i2p::ProxyStatus = i2p::check_connection().await; + if status == i2p::ProxyStatus::Open { + Custom(Status::Ok, Json(i2p::HttpProxyStatus { open: true })) + } else { + Custom(Status::Ok, Json(i2p::HttpProxyStatus { open: false })) + } } /// Share your contact information