Config initialization moved to HandleDebuggerRequest

This commit is contained in:
Nemoumbra 2023-06-01 17:12:22 +03:00
parent 311687a673
commit af8480683a
2 changed files with 8 additions and 5 deletions

View file

@ -148,6 +148,12 @@ void HandleDebuggerRequest(const http::Request &request) {
InputBroadcaster input;
SteppingBroadcaster stepping;
// By default everything is on
allowed_config.emplace("logger", true);
allowed_config.emplace("game", true);
allowed_config.emplace("stepping", true);
allowed_config.emplace("input", true);
std::unordered_map<std::string, DebuggerEventHandler> eventHandlers;
std::vector<DebuggerSubscriber *> subscriberData;
for (auto init : subscribers) {
@ -193,6 +199,7 @@ void HandleDebuggerRequest(const http::Request &request) {
// These send events that aren't just responses to requests
// The client can explicitly ask not to be notified about some events
// so we check the client settings first
if (allowed_config.at("logger"))
logger.Broadcast(ws);
if (allowed_config.at("game"))

View file

@ -35,11 +35,7 @@ using namespace json;
struct WebSocketClientInfo {
WebSocketClientInfo() : name(), version(), allowed() {
// By default everything is on
allowed.emplace("logger", true);
allowed.emplace("game", true);
allowed.emplace("stepping", true);
allowed.emplace("input", true);
}
std::string name;