From 83e924201c2c6844d99301d4391b5f9e378b964b Mon Sep 17 00:00:00 2001 From: Edo Date: Sun, 23 Oct 2022 14:40:26 +0100 Subject: [PATCH] [Party] Remove doubly added backslash (#537) * [Party] Remove doubly added backslash * [ServerInfo] Add version to the info endpoint --- src/Components/Modules/Download.cpp | 6 ++---- src/Components/Modules/Party.cpp | 2 +- src/Components/Modules/ServerInfo.cpp | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 5685bc92..4e32b2bc 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -743,10 +743,8 @@ namespace Components // Only handle http requests if (ev != MG_EV_HTTP_REQUEST) return; - //if (!Download::VerifyPassword(nc, reinterpret_cast(ev_data))) return; - - Utils::InfoString status = ServerInfo::GetInfo(); - Utils::InfoString host = ServerInfo::GetHostInfo(); + const auto status = ServerInfo::GetInfo(); + const auto host = ServerInfo::GetHostInfo(); std::map info; info["status"] = status.to_json(); diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index 8672d402..fa55182b 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -397,7 +397,7 @@ namespace Components info.set("wwwDownload", (Dvar::Var("sv_wwwDownload").get() ? "1" : "0")); info.set("wwwUrl", Dvar::Var("sv_wwwBaseUrl").get()); - Network::SendCommand(address, "infoResponse", "\\" + info.build()); + Network::SendCommand(address, "infoResponse", info.build()); }); Network::OnClientPacket("infoResponse", [](const Network::Address& address, [[maybe_unused]] const std::string& data) diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index eed972a8..e39e9472 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -141,6 +141,7 @@ namespace Components info.set("sv_maxclients", Utils::String::VA("%i", maxClientCount)); info.set("protocol", Utils::String::VA("%i", PROTOCOL)); info.set("shortversion", SHORTVERSION); + info.set("version", (*Game::version)->current.string); info.set("mapname", (*Game::sv_mapname)->current.string); info.set("isPrivate", (Dvar::Var("g_password").get().empty() ? "0" : "1")); info.set("checksum", Utils::String::VA("%X", Utils::Cryptography::JenkinsOneAtATime::Compute(Utils::String::VA("%u", Game::Sys_Milliseconds())))); @@ -226,7 +227,7 @@ namespace Components playerList.append(Utils::String::VA("%i %i \"%s\"\n", score, ping, name.data())); } - Network::SendCommand(address, "statusResponse", "\\" + info.build() + "\n" + playerList + "\n"); + Network::SendCommand(address, "statusResponse", info.build() + "\n" + playerList + "\n"); }); Network::OnClientPacket("statusResponse", [](const Network::Address& address, [[maybe_unused]] const std::string& data)