🐎 made getlogs endpoint cache result when disabled

This commit is contained in:
EntireTwix 2021-06-03 12:47:50 -07:00
parent 3609291e31
commit a78b4e5b1d
2 changed files with 26 additions and 24 deletions

View file

@ -170,8 +170,6 @@ public:
}
Json::Value GetLogs(const std::string &name, const std::string &attempt)
{
if constexpr (max_log_size)
{
Json::Value res;
if (!users.if_contains(name, [&res, &attempt](const User &u) {
@ -189,11 +187,6 @@ public:
}
return res;
}
else
{
return "logs are disabled";
}
}
void Save()
{

View file

@ -112,10 +112,19 @@ public:
JSON(bank.AdminVerifyPass(body["attempt"].asCString()));
}
void GetLog(req_args, const std::string &name)
{
if constexpr (max_log_size)
{
GEN_BODY
JSON(bank.GetLogs(name, body["attempt"].asCString()));
}
else
{
auto resp = HttpResponse::newHttpJsonResponse(JsonReturn("Logs are Disabled"));
resp->setExpiredTime(0); //cached forever
callback(resp);
}
}
METHOD_LIST_BEGIN
METHOD_ADD(BankF::Close, "/admin/close", Post, Options);