mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-04-21 11:06:43 +02:00
Compare commits
2 Commits
ce05d67166
...
fd31477739
Author | SHA1 | Date | |
---|---|---|---|
|
fd31477739 | ||
|
6d3ee13d87 |
@ -132,10 +132,12 @@ function SystemController:apigateway(...)
|
|||||||
r, e = loadfile(ospath)
|
r, e = loadfile(ospath)
|
||||||
if r then
|
if r then
|
||||||
local status, result = pcall(r, data.parameters)
|
local status, result = pcall(r, data.parameters)
|
||||||
if (status) then
|
if result then
|
||||||
echo(JSON.encode(result))
|
if (status) then
|
||||||
else
|
echo(JSON.encode(result))
|
||||||
echo(result)
|
else
|
||||||
|
echo(result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
echo(e)
|
echo(e)
|
||||||
@ -192,7 +194,14 @@ function SystemController:apigateway(...)
|
|||||||
data = JSON.decodeString(REQUEST.json)
|
data = JSON.decodeString(REQUEST.json)
|
||||||
exec_with_user_priv(data)
|
exec_with_user_priv(data)
|
||||||
elseif args and #args > 0 then
|
elseif args and #args > 0 then
|
||||||
local decoded = std.b64decode(args[1])
|
-- data is encoded in url safe base64
|
||||||
|
local encoded = args[1]:gsub('_', '/'):gsub('-', '+')
|
||||||
|
if #encoded % 4 == 2 then
|
||||||
|
encoded = encoded.."=="
|
||||||
|
elseif #encoded %4 == 3 then
|
||||||
|
encoded = encoded.."="
|
||||||
|
end
|
||||||
|
local decoded = std.b64decode(encoded)
|
||||||
data = JSON.decodeString(bytes.__tostring(decoded))
|
data = JSON.decodeString(bytes.__tostring(decoded))
|
||||||
if data and data.path then
|
if data and data.path then
|
||||||
exec_with_user_priv(data)
|
exec_with_user_priv(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user