Skip to content

Fixed issues #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ std::string get_str_between_two_str(const std::string& s, const std::string& sta
int VerifyPayload(std::string signature, std::string timestamp, std::string body);
void checkInit();
std::string checksum();
void debugInfo(std::string data, std::string url, std::string response, std::string headers);
void modify();
void runChecks();
void checkAtoms();
Expand All @@ -78,6 +77,7 @@ std::string signature;
std::string signatureTimestamp;
bool initialized;
std::string API_PUBLIC_KEY = "5586b4bc69c7a4b487e4563a4cd96afd39140f919bd31cea7d1c6a1e8439422b";
bool KeyAuth::api::debug = false;

void KeyAuth::api::init()
{
Expand Down Expand Up @@ -1659,6 +1659,10 @@ std::string get_str_between_two_str(const std::string& s,
last_delim_pos - end_pos_of_first_delim);
}

void KeyAuth::api::setDebug(bool value) {
KeyAuth::api::debug = value;
}

std::string KeyAuth::api::req(std::string data, std::string url) {
CURL* curl = curl_easy_init();
if (!curl)
Expand Down
8 changes: 5 additions & 3 deletions auth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace KeyAuth {
std::string name, ownerid, version, url, path;
static bool debug;

api(std::string name, std::string ownerid, std::string version, std::string url, std::string path, bool debug = false) {
debug = debug;
api(std::string name, std::string ownerid, std::string version, std::string url, std::string path, bool debugParameter = true) {
setDebug(debugParameter);
}

void ban(std::string reason = "");
Expand Down Expand Up @@ -108,6 +108,8 @@ namespace KeyAuth {
static std::string req(std::string data, std::string url);

static void debugInfo(std::string data, std::string url, std::string response, std::string headers);

static void setDebug(bool value);


void load_user_data(nlohmann::json data) {
Expand Down Expand Up @@ -137,7 +139,7 @@ namespace KeyAuth {
api::app_data.version = data[XorStr("version")];
api::app_data.customerPanelLink = data[XorStr("customerPanelLink")];
}

void load_response_data(nlohmann::json data) {
api::response.success = data[XorStr("success")];
api::response.message = data["message"];
Expand Down