mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-11-27 00:43:47 +00:00
Fix token generation and pastie expiry.
This commit is contained in:
parent
28cf0ff9b8
commit
e649a7bec1
1 changed files with 3 additions and 0 deletions
|
@ -1,9 +1,11 @@
|
||||||
local function num_to_token (num)
|
local function num_to_token (num)
|
||||||
local retval = ""
|
local retval = ""
|
||||||
local running = true
|
local running = true
|
||||||
|
num = num + 1
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
do
|
do
|
||||||
|
num = num - 1
|
||||||
local remainder = num % 26
|
local remainder = num % 26
|
||||||
retval = string.char(97 + remainder) .. retval
|
retval = string.char(97 + remainder) .. retval
|
||||||
num = math.floor(num / 26)
|
num = math.floor(num / 26)
|
||||||
|
@ -36,6 +38,7 @@ local saved = redis.call("HMSET", token_prefix .. token,
|
||||||
"selfdes", selfdestruct
|
"selfdes", selfdestruct
|
||||||
)
|
)
|
||||||
if saved then
|
if saved then
|
||||||
|
redis.call("EXPIRE", token_prefix .. token, ttl)
|
||||||
redis.call("SET", flooding_token, "")
|
redis.call("SET", flooding_token, "")
|
||||||
redis.call("EXPIRE", flooding_token, flood_wait)
|
redis.call("EXPIRE", flooding_token, flood_wait)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue