some optimization
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run

This commit is contained in:
wt committed 2025-02-14 11:54:07 +07:00
1 parent f5b92b8e50
commit aeefe1ea7f
5 files changed
+25 -17

No files matched your search

+4 -5
View File
@@ -62,7 +62,7 @@ void add_user(const httplib::Request& request, httplib::Response& response)
return;
}
std::ifstream usersfile("users.json");
std::ifstream usersfile(USERS_FILE);
nlohmann::json all_users = nlohmann::json::parse(usersfile);
usersfile.close();
@@ -104,11 +104,10 @@ void add_user(const httplib::Request& request, httplib::Response& response)
new_user_data << "}";
all_users.push_back(nlohmann::json::parse(new_user_data));
std::ofstream usersfilew("users.json");
std::ofstream usersfilew(USERS_FILE);
usersfilew << all_users.dump(4);
usersfilew.close();
std::stringstream syslogstring;
syslogstring << "user added [" << username << "]";
syslog(LOG_INFO, syslogstring.str().c_str());
std::string syslogstring = "user added [" + username + "]";
syslog(LOG_INFO, syslogstring.c_str());
response.set_content(R"({"status":"ok"})", JSON_TYPE);
}