[ServerInfo] Add host info to /info
This commit is contained in:
parent
8e69de5083
commit
6176d26fbb
@ -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/).
|
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
|
## [0.6.0] - 2018-12-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -701,9 +701,11 @@ namespace Components
|
|||||||
//if (!Download::VerifyPassword(nc, reinterpret_cast<http_message*>(ev_data))) return;
|
//if (!Download::VerifyPassword(nc, reinterpret_cast<http_message*>(ev_data))) return;
|
||||||
|
|
||||||
Utils::InfoString status = ServerInfo::GetInfo();
|
Utils::InfoString status = ServerInfo::GetInfo();
|
||||||
|
Utils::InfoString host = ServerInfo::GetHostInfo();
|
||||||
|
|
||||||
std::map<std::string, json11::Json> info;
|
std::map<std::string, json11::Json> info;
|
||||||
info["status"] = status.to_json();
|
info["status"] = status.to_json();
|
||||||
|
info["host"] = host.to_json();
|
||||||
|
|
||||||
std::vector<json11::Json> players;
|
std::vector<json11::Json> players;
|
||||||
|
|
||||||
|
@ -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<const char*>());
|
||||||
|
info.set("website", Dvar::Var("_Website").get<const char*>());
|
||||||
|
info.set("email", Dvar::Var("_Email").get<const char*>());
|
||||||
|
info.set("location", Dvar::Var("_Location").get<const char*>());
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
Utils::InfoString ServerInfo::GetInfo()
|
Utils::InfoString ServerInfo::GetInfo()
|
||||||
{
|
{
|
||||||
int maxclientCount = *Game::svs_numclients;
|
int maxclientCount = *Game::svs_numclients;
|
||||||
|
@ -8,6 +8,7 @@ namespace Components
|
|||||||
ServerInfo();
|
ServerInfo();
|
||||||
~ServerInfo();
|
~ServerInfo();
|
||||||
|
|
||||||
|
static Utils::InfoString GetHostInfo();
|
||||||
static Utils::InfoString GetInfo();
|
static Utils::InfoString GetInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user