diff --git a/server/config.cpp b/server/config.cpp index 10402f03..41443def 100644 --- a/server/config.cpp +++ b/server/config.cpp @@ -55,9 +55,16 @@ Config::Config() { ClientInfoPtr client = make_shared(); client->fromJson(*it); + if (client->host.mac.empty()) + continue; + for (const auto& c: clients) + { + if (c->host.mac == client->host.mac) + continue; + } + client->connected = false; clients.push_back(client); - // logO << "Client:\n" << std::setw(4) << client->toJson() << '\n'; } } } diff --git a/server/config.h b/server/config.h index 04d91fc5..895103db 100644 --- a/server/config.h +++ b/server/config.h @@ -209,7 +209,9 @@ struct ClientInfo void fromJson(const json& j) { if (j.count("host") && !j["host"].is_string()) + { host.fromJson(j["host"]); + } else { host.ip = jGet(j, "IP", ""); @@ -223,7 +225,9 @@ struct ClientInfo snapclient.version = jGet(j, "version", ""); if (j.count("config")) - host.fromJson(j["config"]); + { + config.fromJson(j["config"]); + } else { config.name = trim_copy(jGet(j, "name", ""));