From 275010eaa0a46012fec547efdd76256b25e47f54 Mon Sep 17 00:00:00 2001 From: auth Date: Tue, 14 Jul 2020 16:16:02 +0200 Subject: Client login handling on server. More error handling for forum responses. --- server/src/client/blacklist.h | 16 ++-------------- server/src/client/client.h | 5 +++-- 2 files changed, 5 insertions(+), 16 deletions(-) (limited to 'server/src/client') diff --git a/server/src/client/blacklist.h b/server/src/client/blacklist.h index 70f5c7a..b2bc9f8 100644 --- a/server/src/client/blacklist.h +++ b/server/src/client/blacklist.h @@ -1,10 +1,5 @@ #pragma once -struct blacklist_data { - std::string ip; - std::string hwid; -}; - class blacklist { nlohmann::json m_data; std::string m_name; @@ -24,9 +19,8 @@ class blacklist { m_data = nlohmann::json::parse(data); } - void add(const blacklist_data &data) { - m_data["ips"].emplace_back(data.ip); - m_data["hwids"].emplace_back(data.hwid); + void add(const std::string_view hwid) { + m_data["hwids"].emplace_back(hwid); save(); } @@ -38,12 +32,6 @@ class blacklist { } bool find(const std::string &key) { - for (auto &item : m_data["ips"]) { - if (item.get() == key) { - return true; - } - } - for (auto &item : m_data["hwids"]) { if (item.get() == key) { return true; diff --git a/server/src/client/client.h b/server/src/client/client.h index 2777a0d..0f8c338 100644 --- a/server/src/client/client.h +++ b/server/src/client/client.h @@ -7,11 +7,12 @@ enum client_state { idle = 0, logged_in, waiting, injected }; -enum login_result { +enum client_response { login_fail = 15494, hwid_mismatch = 11006, login_success = 61539, - banned = 28618 + banned = 28618, + server_error = 98679 }; class client { -- cgit v1.2.3