fix upt calculate issue
This commit is contained in:
@@ -20,7 +20,9 @@ server {
|
|||||||
set $upyun_directory "music-room";
|
set $upyun_directory "music-room";
|
||||||
set $upyun_domain "https://upyun.alchemy-studio.cn";
|
set $upyun_domain "https://upyun.alchemy-studio.cn";
|
||||||
set $wx_domain "wx.alchemy-studio.cn";
|
set $wx_domain "wx.alchemy-studio.cn";
|
||||||
set $upt_secret "0D32E581A445404FA4C306709724FA07";
|
set $upt_huiwings_secret "C5E4B01EC86A4CE8A84871EA2C826DD1";
|
||||||
|
set $upt_moicen_secret "339666FBB93C46D7B00D9F6E790C6C18";
|
||||||
|
set $upt_alchemy_secret "0D32E581A445404FA4C306709724FA07";
|
||||||
set $upt_duration 3600;
|
set $upt_duration 3600;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ server {
|
|||||||
set $upyun_directory "music-room";
|
set $upyun_directory "music-room";
|
||||||
set $upyun_domain "https://upyun.huiwings.cn";
|
set $upyun_domain "https://upyun.huiwings.cn";
|
||||||
set $wx_domain "wx.huiwings.cn";
|
set $wx_domain "wx.huiwings.cn";
|
||||||
set $upt_secret "0D32E581A445404FA4C306709724FA07";
|
set $upt_huiwings_secret "C5E4B01EC86A4CE8A84871EA2C826DD1";
|
||||||
|
set $upt_moicen_secret "339666FBB93C46D7B00D9F6E790C6C18";
|
||||||
|
set $upt_alchemy_secret "0D32E581A445404FA4C306709724FA07";
|
||||||
set $upt_duration 3600;
|
set $upt_duration 3600;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ server {
|
|||||||
set $upyun_domain "https://upyun.moicen.com";
|
set $upyun_domain "https://upyun.moicen.com";
|
||||||
set $upyun_cdn "https://upyun.moicen.com/";
|
set $upyun_cdn "https://upyun.moicen.com/";
|
||||||
set $wx_domain "wx.moicen.com";
|
set $wx_domain "wx.moicen.com";
|
||||||
set $upt_secret "339666FBB93C46D7B00D9F6E790C6C18";
|
set $upt_huiwings_secret "C5E4B01EC86A4CE8A84871EA2C826DD1";
|
||||||
|
set $upt_moicen_secret "339666FBB93C46D7B00D9F6E790C6C18";
|
||||||
|
set $upt_alchemy_secret "0D32E581A445404FA4C306709724FA07";
|
||||||
set $upt_duration 3600;
|
set $upt_duration 3600;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
+13
-1
@@ -7,8 +7,20 @@ local _M = {}
|
|||||||
--local strip_path = require("strip_path")
|
--local strip_path = require("strip_path")
|
||||||
--local Upyun = require('upyun')
|
--local Upyun = require('upyun')
|
||||||
|
|
||||||
|
function host(s)
|
||||||
|
return (s.."/"):match("://(.-)/")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function _M.upt(uri)
|
function _M.upt(uri)
|
||||||
local secret = ngx.var.upt_secret
|
local hostname = host(uri)
|
||||||
|
|
||||||
|
local upt_table = {}
|
||||||
|
upt_table["moicen.com"] = ngx.var.upt_moicen_secret,
|
||||||
|
upt_table["alchemy-studio.cn"] = ngx.var.upt_alchemy_secret,
|
||||||
|
upt_table["huiwings.cn"] = ngx.var.upt_huiwings_secret
|
||||||
|
local secret = upt_table[hostname]
|
||||||
|
ngx.log(ngx.INFO, 'url...' .. uri .. ' host...' .. hostname .. 'secret...' .. secret)
|
||||||
local duration = ngx.var.upt_duration
|
local duration = ngx.var.upt_duration
|
||||||
local etime = os.time() + duration
|
local etime = os.time() + duration
|
||||||
local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri)
|
local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri)
|
||||||
|
|||||||
Reference in New Issue
Block a user