diff options
| author | auth <[email protected]> | 2020-07-14 16:16:02 +0200 |
|---|---|---|
| committer | auth <[email protected]> | 2020-07-14 16:16:02 +0200 |
| commit | 275010eaa0a46012fec547efdd76256b25e47f54 (patch) | |
| tree | 00d9e0a19424c3e3d81e2ed74d7986da987123d1 /server/src/client | |
| parent | Forum integration. (diff) | |
| download | loader-275010eaa0a46012fec547efdd76256b25e47f54.tar.xz loader-275010eaa0a46012fec547efdd76256b25e47f54.zip | |
Client login handling on server.
More error handling for forum responses.
Diffstat (limited to 'server/src/client')
| -rw-r--r-- | server/src/client/blacklist.h | 16 | ||||
| -rw-r--r-- | server/src/client/client.h | 5 |
2 files changed, 5 insertions, 16 deletions
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<std::string>() == key) { - return true; - } - } - for (auto &item : m_data["hwids"]) { if (item.get<std::string>() == 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 { |