http: add /config

This commit is contained in:
Lion Kortlepel
2022-05-23 18:44:42 +02:00
parent b46dc664c6
commit f7acd1e819
2 changed files with 45 additions and 0 deletions

View File

@@ -157,6 +157,20 @@ void Http::Server::THttpServerInstance::operator()() try {
HttpLibServerInstance->Get("/", [](const httplib::Request&, httplib::Response& res) {
res.set_content("<!DOCTYPE html><article><h1>Hello World!</h1><section><p>BeamMP Server can now serve HTTP requests!</p></section></article></html>", "text/html");
});
HttpLibServerInstance->Get(API_V1 "/config", [](const httplib::Request&, httplib::Response& res) {
res.status = 200;
res.set_content(json {
{ "name", Application::Settings.ServerName },
{ "description", Application::Settings.ServerDesc },
{ "max_players", Application::Settings.MaxPlayers },
{ "max_cars", Application::Settings.MaxCars },
{ "map", Application::Settings.MapName },
{ "private", Application::Settings.Private },
}
.dump(),
"application/json");
});
HttpLibServerInstance->Get(API_V1 "/ready", [](const httplib::Request&, httplib::Response& res) {
auto Statuses = Application::GetSubsystemStatuses();
bool Started = true;