diff --git a/CHANGELOG.md b/CHANGELOG.md index 959ab587..bd2732bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [unreleased] - xxxx-xx-xx + +### Added + +- Add host information to /info endpoint (request) + ## [0.6.0] - 2018-12-30 ### Added diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 628f3652..a9d98774 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -701,9 +701,11 @@ namespace Components //if (!Download::VerifyPassword(nc, reinterpret_cast(ev_data))) return; Utils::InfoString status = ServerInfo::GetInfo(); + Utils::InfoString host = ServerInfo::GetHostInfo(); std::map info; info["status"] = status.to_json(); + info["host"] = host.to_json(); std::vector players; diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index 29bbe78c..c5b8ffe9 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -110,6 +110,19 @@ namespace Components } } + Utils::InfoString ServerInfo::GetHostInfo() + { + Utils::InfoString info; + + // TODO: Possibly add all Dvar starting with _ + info.set("admin", Dvar::Var("_Admin").get()); + info.set("website", Dvar::Var("_Website").get()); + info.set("email", Dvar::Var("_Email").get()); + info.set("location", Dvar::Var("_Location").get()); + + return info; + } + Utils::InfoString ServerInfo::GetInfo() { int maxclientCount = *Game::svs_numclients; diff --git a/src/Components/Modules/ServerInfo.hpp b/src/Components/Modules/ServerInfo.hpp index d7e0cf17..8fceb827 100644 --- a/src/Components/Modules/ServerInfo.hpp +++ b/src/Components/Modules/ServerInfo.hpp @@ -8,6 +8,7 @@ namespace Components ServerInfo(); ~ServerInfo(); + static Utils::InfoString GetHostInfo(); static Utils::InfoString GetInfo(); private: