mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-04-19 01:56:44 +02:00
Compare commits
2 Commits
ce05d67166
...
fd31477739
Author | SHA1 | Date | |
---|---|---|---|
|
fd31477739 | ||
|
6d3ee13d87 |
@ -132,10 +132,12 @@ function SystemController:apigateway(...)
|
||||
r, e = loadfile(ospath)
|
||||
if r then
|
||||
local status, result = pcall(r, data.parameters)
|
||||
if (status) then
|
||||
echo(JSON.encode(result))
|
||||
else
|
||||
echo(result)
|
||||
if result then
|
||||
if (status) then
|
||||
echo(JSON.encode(result))
|
||||
else
|
||||
echo(result)
|
||||
end
|
||||
end
|
||||
else
|
||||
echo(e)
|
||||
@ -192,7 +194,14 @@ function SystemController:apigateway(...)
|
||||
data = JSON.decodeString(REQUEST.json)
|
||||
exec_with_user_priv(data)
|
||||
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))
|
||||
if data and data.path then
|
||||
exec_with_user_priv(data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user