1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-11-23 00:33:44 +00:00

Fix some mistakes.

The counter was missing the kamokan prefix
SelfDestruct was not working
This commit is contained in:
King_DuckZ 2017-06-23 21:57:44 +01:00
parent 6222f1e1b1
commit 100edb6628
2 changed files with 7 additions and 3 deletions

View file

@ -8,7 +8,7 @@ end
local selfdes = 0 local selfdes = 0
local deleted = 0 local deleted = 0
if result[2] == 1 then if result[2] == "1" then
deleted = redis.call("DEL", full_token) deleted = redis.call("DEL", full_token)
selfdes = 1 selfdes = 1
end end

View file

@ -30,9 +30,11 @@
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#define TOKEN_PREFIX "kamokan:{store:}"
namespace kamokan { namespace kamokan {
namespace { namespace {
const char g_token_prefix[] = "kamokan:{store:}"; const char g_token_prefix[] = TOKEN_PREFIX;
redis::IncRedis make_incredis (const SettingsBag& parSettings) { redis::IncRedis make_incredis (const SettingsBag& parSettings) {
using redis::IncRedis; using redis::IncRedis;
@ -144,7 +146,7 @@ namespace kamokan {
redis::Script retrieve = m_redis->command().make_script(string_view(g_save_script, g_save_script_size)); redis::Script retrieve = m_redis->command().make_script(string_view(g_save_script, g_save_script_size));
auto batch = m_redis->command().make_batch(); auto batch = m_redis->command().make_batch();
{ {
string_view paste_counter_token("{store:}paste_counter"); string_view paste_counter_token(TOKEN_PREFIX "paste_counter");
std::string prefix(g_token_prefix); std::string prefix(g_token_prefix);
const auto expiry = lexical_cast<std::string>(parExpiry); const auto expiry = lexical_cast<std::string>(parExpiry);
const auto self_des = string_view(parSelfDestruct ? "1" : "0"); const auto self_des = string_view(parSelfDestruct ? "1" : "0");
@ -230,3 +232,5 @@ namespace kamokan {
} }
#endif #endif
} //namespace kamokan } //namespace kamokan
#undef TOKEN_PREFIX