From cc5ab170f99a1d9b18e6143259c23f5368d3efdf Mon Sep 17 00:00:00 2001 From: Kappa322 Date: Sun, 8 Sep 2024 22:15:31 +0200 Subject: [PATCH] Improve evtc rpc server status text to include encryption disabled/enabled --- networking/Client.cpp | 4 +++- networking/Client.h | 1 + src/GUI.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/networking/Client.cpp b/networking/Client.cpp index c79828f..d2dffe7 100644 --- a/networking/Client.cpp +++ b/networking/Client.cpp @@ -434,6 +434,7 @@ void evtc_rpc_client::Serve() std::string endpoint = mEndpointCallback(); bool missingPort = false; + bool disableEncryption = mDisableEncryption; if (endpoint.find(':') == endpoint.npos) { missingPort = true; @@ -443,7 +444,7 @@ void evtc_rpc_client::Serve() options.pem_root_certs = mRootCertificatesCallback(); std::shared_ptr channel_creds; - if (mDisableEncryption == true) + if (disableEncryption == true) { if (missingPort == true) { @@ -478,6 +479,7 @@ void evtc_rpc_client::Serve() { std::lock_guard status_lock{mStatusLock}; mStatus.Endpoint = endpoint; + mStatus.Encrypted = !disableEncryption; } } } diff --git a/networking/Client.h b/networking/Client.h index 85bb142..1d9e6c1 100644 --- a/networking/Client.h +++ b/networking/Client.h @@ -36,6 +36,7 @@ struct evtc_rpc_client_status { bool Connected = false; + bool Encrypted = false; std::chrono::steady_clock::time_point ConnectTime; std::string Endpoint; }; diff --git a/src/GUI.cpp b/src/GUI.cpp index a3cf935..01daec1 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -651,7 +651,12 @@ static void Display_EvtcRpcStatus(const HealTableOptions& pHealingOptions) if (status.Connected == true) { uint64_t seconds = std::chrono::duration_cast(std::chrono::steady_clock::now() - status.ConnectTime).count(); - ImGui::TextColored(ImVec4(0.0f, 0.75f, 0.0f, 1.0f), "Connected to %s for %llu seconds", status.Endpoint.c_str(), seconds); + const char* encryptString = "with"; + if (status.Encrypted == false) + { + encryptString = "without"; + } + ImGui::TextColored(ImVec4(0.0f, 0.75f, 0.0f, 1.0f), "Connected to %s for %llu seconds %s encryption", status.Endpoint.c_str(), seconds, encryptString); } else if (pHealingOptions.EvtcRpcEnabled == false) {