更新 target/fwutils/request_config.lua

This commit is contained in:
2026-03-31 15:54:55 +08:00
parent 3112537fd6
commit 747dcb86af

View File

@@ -29,14 +29,13 @@ M.init = function(website_config)
if M.__url_param ~= nil then
M.__action = M.__url_param["action"]
end
-- 获取TOKEN
local token = string.match(request.header("Cookie"),"token=(%w+)")
-- 获取TOKEN 优先顺序: X-Auth-Token -> Cookie.token -> url的token
local token = request.header("X-Auth-Token")
if token == nil or token == "" then
token = M.__url_param["token"]
if token ~= nil then
response.header("Set-Cookie","token="..token..";Path=/")
if token == nil or token == "" then
token = string.match(request.header("Cookie"),"token=(%w+)")
end
end
if token ~= nil and token ~= "" then
local result,user_data = token_module.get(token)