address feedback

This commit is contained in:
Aaron Kimbre 2024-04-25 22:27:28 -05:00
parent c3ea448be0
commit 9192dca4e6
6 changed files with 23 additions and 15 deletions

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include <nlohmann/json.hpp>
#include "ChatWebApi.h" #include "ChatWebApi.h"
#include <cstdint>
#include "dCommonVars.h" #include "dCommonVars.h"
#include "eConnectionType.h" #include "eConnectionType.h"
#include "eChatMessageType.h" #include "eChatMessageType.h"
@ -9,8 +9,8 @@
#include "dServer.h" #include "dServer.h"
#include "PlayerContainer.h" #include "PlayerContainer.h"
#include "dConfig.h" #include "dConfig.h"
#include "httplib.h"
using json = nlohmann::json; #include "json.h"
namespace { namespace {
httplib::Server m_APIServer; httplib::Server m_APIServer;
@ -86,8 +86,6 @@ void ChatWebApi::Listen(const uint32_t port) {
}; };
void ChatWebApi::Stop(){ void ChatWebApi::Stop(){
if (Game::config->GetValue("enable_chat_web_api") == "1") { LOG("Stopping Chat Web API server...");
LOG("Stopping Chat Web API server..."); m_APIServer.stop();
m_APIServer.stop();
}
} }

View File

@ -1,4 +1,4 @@
#include "httplib.h" #include <cstdint>
namespace ChatWebApi { namespace ChatWebApi {
void Listen(const uint32_t port); void Listen(const uint32_t port);

View File

@ -1,7 +1,8 @@
#include "PlayerContainer.h"
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include "PlayerContainer.h"
#include "dNetCommon.h" #include "dNetCommon.h"
#include "Game.h" #include "Game.h"
#include "Logger.h" #include "Logger.h"
@ -14,7 +15,6 @@
#include "dConfig.h" #include "dConfig.h"
#include "eChatMessageType.h" #include "eChatMessageType.h"
const json PlayerData::to_json() const { const json PlayerData::to_json() const {
json data; json data;
data["id"] = this->playerID; data["id"] = this->playerID;

View File

@ -6,9 +6,7 @@
#include "Game.h" #include "Game.h"
#include "dServer.h" #include "dServer.h"
#include <unordered_map> #include <unordered_map>
#include "json.h"
#include <nlohmann/json.hpp>
using json = nlohmann::json;
enum class eGameMasterLevel : uint8_t; enum class eGameMasterLevel : uint8_t;

10
dCommon/json.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef __JSON__H__
#define __JSON__H__
#include "nlohmann/json.hpp"
namespace {
using json = nlohmann::json;
}
#endif // !__JSON__H__

View File

@ -48,6 +48,7 @@ paths:
get: get:
tags: tags:
- user - user
summary: Get all online Players
responses: responses:
"200": "200":
description: Successful operation description: Successful operation
@ -64,6 +65,7 @@ paths:
get: get:
tags: tags:
- user - user
summary: Get all active Teams
responses: responses:
"200": "200":
description: Successful operation description: Successful operation