From 1249e2c80bcc82381cb993dc315037dc2caf6c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Tue, 23 Aug 2022 01:11:25 +0800 Subject: [PATCH] add upt lua --- scripts/lib/upt.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/lib/upt.lua diff --git a/scripts/lib/upt.lua b/scripts/lib/upt.lua new file mode 100644 index 0000000..e9d71e5 --- /dev/null +++ b/scripts/lib/upt.lua @@ -0,0 +1,20 @@ +-- 指定模块引用目录,否则无法加载同目录下的其他文件 +--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua'; +package.path = package.path .. ';/?.lua'; + +local _M = {} + +--local strip_path = require("strip_path") +--local Upyun = require('upyun') + +function _M.upt(uri) { + local secret = ngx.var.upt_secret + local duration = ngx.var.upt_duration + local etime = os.time() + duration + local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri) + ngx.log(ngx.ERR, 'sign...' .. sign .. ' etime..' .. etime) + local upt = string.sub(sign, 13, 13 + 7) .. etime + ngx.say(upt) +} + +return _M \ No newline at end of file