From e649a7bec1d0871aeaca7df14e49368a0a4b1226 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 12 Oct 2018 20:58:21 +0100 Subject: [PATCH] Fix token generation and pastie expiry. --- src/kamokan_impl/save_pastie.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kamokan_impl/save_pastie.lua b/src/kamokan_impl/save_pastie.lua index f87ca3a..056f064 100644 --- a/src/kamokan_impl/save_pastie.lua +++ b/src/kamokan_impl/save_pastie.lua @@ -1,9 +1,11 @@ local function num_to_token (num) local retval = "" local running = true + num = num + 1 while (running) do + num = num - 1 local remainder = num % 26 retval = string.char(97 + remainder) .. retval num = math.floor(num / 26) @@ -36,6 +38,7 @@ local saved = redis.call("HMSET", token_prefix .. token, "selfdes", selfdestruct ) if saved then + redis.call("EXPIRE", token_prefix .. token, ttl) redis.call("SET", flooding_token, "") redis.call("EXPIRE", flooding_token, flood_wait) else