revert i2p status check back to json

This commit is contained in:
creating2morrow 2023-05-18 02:12:28 -04:00
parent d00a0be810
commit ba0c50c170
2 changed files with 8 additions and 2 deletions

View file

@ -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();

View file

@ -34,8 +34,13 @@ pub async fn get_version(_jwp: proof::PaymentProof) -> Custom<Json<reqres::XmrRp
///
/// This also functions as a health check
#[get("/status")]
pub async fn get_i2p_status() -> Custom<Json<i2p::ProxyStatus>> {
Custom(Status::Ok, Json(i2p::check_connection().await))
pub async fn get_i2p_status() -> Custom<Json<i2p::HttpProxyStatus>> {
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