From ce992183483fb02d9af40631afc9adcb562e4e4d Mon Sep 17 00:00:00 2001 From: DanyLE Date: Fri, 19 Aug 2022 15:10:55 +0200 Subject: [PATCH] update OS backend --- Makefile | 4 ++-- os/controllers/SystemController.lua | 10 +++++++++- os/libs/common.lua | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 69c55fc..1e807e9 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ main: copy for f in $(PROJS); do BUILDDIR=$(BUILDDIR)/"$${f}" make -C "$${f}" ; done copy: - cp -rf $(copyfiles) $(BUILDDIR) - cp -r silk $(BUILDDIR) + cp -rfv $(copyfiles) $(BUILDDIR) + cp -rv silk $(BUILDDIR) ar: -[ -d /tmp/antd_web_apps ] && rm -r /tmp/antd_web_apps diff --git a/os/controllers/SystemController.lua b/os/controllers/SystemController.lua index 3811fa3..28b005a 100644 --- a/os/controllers/SystemController.lua +++ b/os/controllers/SystemController.lua @@ -98,6 +98,7 @@ function SystemController:application(...) end function SystemController:apigateway(...) + local args={...} local use_ws = false if REQUEST and REQUEST.ws == "1" then -- override the global echo command @@ -189,8 +190,15 @@ function SystemController:apigateway(...) exec_with_user_priv(REQUEST) elseif REQUEST.json then data = JSON.decodeString(REQUEST.json) - --std.json() exec_with_user_priv(data) + elseif args and #args > 0 then + local decoded = std.b64decode(args[1]) + data = JSON.decodeString(bytes.__tostring(decoded)) + if data and data.path then + exec_with_user_priv(data) + else + fail("Unknown request") + end else fail("Unkown request") end diff --git a/os/libs/common.lua b/os/libs/common.lua index adbeaf9..bb160ff 100644 --- a/os/libs/common.lua +++ b/os/libs/common.lua @@ -35,6 +35,8 @@ function is_auth() -- should be used only by API call elseif REQUEST.sessionid and REQUEST.sessionid ~= '0' then sessionid = REQUEST.sessionid + elseif REQUEST.access_token and REQUEST.access_token ~= '0' then + sessionid = REQUEST.access_token end if sessionid == nil then return false