2022-08-23 01:11:25 +08:00
|
|
|
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
|
|
|
|
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
|
|
|
|
package.path = package.path .. ';<SCRIPT_PATH>/?.lua';
|
|
|
|
|
|
|
|
|
|
local _M = {}
|
|
|
|
|
|
|
|
|
|
--local strip_path = require("strip_path")
|
|
|
|
|
--local Upyun = require('upyun')
|
|
|
|
|
|
2022-08-23 01:12:31 +08:00
|
|
|
function _M.upt(uri)
|
2022-08-23 01:11:25 +08:00
|
|
|
local secret = ngx.var.upt_secret
|
|
|
|
|
local duration = ngx.var.upt_duration
|
|
|
|
|
local etime = os.time() + duration
|
|
|
|
|
local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri)
|
2022-08-23 13:55:38 +08:00
|
|
|
ngx.log(ngx.INFO, 'sign...' .. sign .. ' etime..' .. etime)
|
2022-08-23 01:11:25 +08:00
|
|
|
local upt = string.sub(sign, 13, 13 + 7) .. etime
|
2022-12-26 22:46:51 +08:00
|
|
|
ngx.log(ngx.INFO, 'upt...' .. upt)
|
2022-08-23 01:14:19 +08:00
|
|
|
return (upt)
|
2022-08-23 01:12:31 +08:00
|
|
|
end
|
2022-08-23 01:11:25 +08:00
|
|
|
|
|
|
|
|
return _M
|