diff --git a/blog/router.lua b/blog/router.lua index 168c249..f457a4c 100644 --- a/blog/router.lua +++ b/blog/router.lua @@ -18,8 +18,8 @@ POST_LIMIT = 2 -- require needed library require(BASE_FRW.."silk.api") -if REQUEST.query.r then - REQUEST.query.r = REQUEST.query.r:gsub("%:", "/") +if REQUEST.r then + REQUEST.r = REQUEST.r:gsub("%:", "/") end -- registry object store global variables diff --git a/blog/views/default/post/detail.ls b/blog/views/default/post/detail.ls index f0b65b6..6398733 100644 --- a/blog/views/default/post/detail.ls +++ b/blog/views/default/post/detail.ls @@ -48,7 +48,7 @@ ") for k,v in pairs(similar_posts) do - echo("
  • "..v.post.title.." (Score: "..string.format("%2.2f",v.st.score)..")
  • ") + echo("
  • "..v.post.title.." (Score: "..string.format("%2.2f",v.st.score)..")
  • ") end echo("") end?> diff --git a/os/controllers/SystemController.lua b/os/controllers/SystemController.lua index d2ee12f..9e10c10 100644 --- a/os/controllers/SystemController.lua +++ b/os/controllers/SystemController.lua @@ -26,7 +26,7 @@ end function SystemController:packages(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) local packages = require("packages") packages.init(rq.args.paths) if rq ~= nil then @@ -52,10 +52,10 @@ function SystemController:settings(...) local user = SESSION.user if user then local ospath = require("vfs").ospath("home:///", user) - if REQUEST.query and REQUEST.query.json then + if REQUEST and REQUEST.json then local f = io.open(ospath .. "/" .. ".settings.json", "w") if f then - f:write(REQUEST.query.json) + f:write(REQUEST.json) f:close() result(true) else @@ -72,10 +72,10 @@ end function SystemController:application(...) auth_or_die("User unauthorized. Please login") local rq = nil - if REQUEST.query.json ~= nil then - rq = (JSON.decodeString(REQUEST.query.json)) + if REQUEST.json ~= nil then + rq = (JSON.decodeString(REQUEST.json)) else - rq = REQUEST.query + rq = REQUEST end if rq.path ~= nil then @@ -97,7 +97,7 @@ end function SystemController:apigateway(...) local use_ws = false - if REQUEST.query and REQUEST.query.ws == "1" then + if REQUEST and REQUEST.ws == "1" then -- override the global echo command echo = std.ws.swrite use_ws = true @@ -180,8 +180,8 @@ function SystemController:apigateway(...) print("Web socket is not available.") end else - if REQUEST.query.json then - data = JSON.decodeString(REQUEST.query.json) + if REQUEST.json then + data = JSON.decodeString(REQUEST.json) --std.json() exec_with_user_priv(data) else diff --git a/os/controllers/UserController.lua b/os/controllers/UserController.lua index 259960c..5e16460 100644 --- a/os/controllers/UserController.lua +++ b/os/controllers/UserController.lua @@ -39,8 +39,8 @@ end return: {} ]] function UserController:login(...) - if REQUEST.query.json ~= nil then - local request = JSON.decodeString(REQUEST.query.json) + if REQUEST.json ~= nil then + local request = JSON.decodeString(REQUEST.json) local r = ulib.auth(request.username,request.password) if r == true then local cookie = {sessionid=std.sha1(request.username..request.password)} -- iotos_user = request.username diff --git a/os/controllers/VDBController.lua b/os/controllers/VDBController.lua index 69ec4f6..e590be6 100644 --- a/os/controllers/VDBController.lua +++ b/os/controllers/VDBController.lua @@ -26,7 +26,7 @@ end function VDBController:save(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if (rq ~= nil and rq.table ~= nil) then local model = require("dbmodel").get(SESSION.user, rq.table, rq.data) local ret @@ -54,7 +54,7 @@ end function VDBController:get(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if (rq ~= nil and rq.table ~= nil) then local model = require("dbmodel").get(SESSION.user, rq.table, nil) local ret @@ -76,7 +76,7 @@ end function VDBController:select(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if (rq ~= nil and rq.table ~= nil) then local model = require("dbmodel").get(SESSION.user, rq.table, nil) local ret @@ -99,7 +99,7 @@ end function VDBController:delete(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if (rq ~= nil and rq.table ~= nil) then local model = require("dbmodel").get(SESSION.user, rq.table, nil) local ret diff --git a/os/controllers/VFSController.lua b/os/controllers/VFSController.lua index 649181e..95e0842 100644 --- a/os/controllers/VFSController.lua +++ b/os/controllers/VFSController.lua @@ -32,7 +32,7 @@ end function VFSController:fileinfo(...) auth_or_die("User unauthorized. Please login") - local vfspath = (JSON.decodeString(REQUEST.query.json)).path + local vfspath = (JSON.decodeString(REQUEST.json)).path local r, m = require("vfs").fileinfo(vfspath) if r then result(m) @@ -46,7 +46,7 @@ function VFSController:exists(...) auth_or_die("User unauthorized. Please login") local vfs = require("vfs") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then result(vfs.exists(rq.path)) @@ -60,7 +60,7 @@ function VFSController:delete(...) auth_or_die("User unauthorized. Please login") local vfs = require("vfs") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then local r, e = vfs.delete(rq.path) @@ -120,7 +120,7 @@ end function VFSController:mkdir(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then local r, m = require("vfs").mkdir(rq.path) @@ -138,7 +138,7 @@ end function VFSController:move(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then local r, m = require("vfs").move(rq.src, rq.dest) @@ -156,7 +156,7 @@ end function VFSController:publish(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then local p = nil @@ -198,7 +198,7 @@ end function VFSController:scandir(...) auth_or_die("User unauthorized. Please login") - local rq = JSON.decodeString(REQUEST.query.json) + local rq = JSON.decodeString(REQUEST.json) local vfspath = rq.path local r = require("vfs").readDir(vfspath) if r == nil then @@ -213,8 +213,8 @@ end function VFSController:upload(...) auth_or_die("User unauthorized. Please login") local vfs = require("vfs") - if REQUEST.query then - local r, m = require("vfs").upload(REQUEST.query.path) + if REQUEST then + local r, m = require("vfs").upload(REQUEST.path) if r then result(r) else @@ -228,7 +228,7 @@ end function VFSController:write(...) auth_or_die("User unauthorized. Please login") - local rq = (JSON.decodeString(REQUEST.query.json)) + local rq = (JSON.decodeString(REQUEST.json)) if rq ~= nil then local r, m = require("vfs").write(rq.path, rq.data) diff --git a/os/libs/vfs.lua b/os/libs/vfs.lua index 0693b9a..aa40c94 100644 --- a/os/libs/vfs.lua +++ b/os/libs/vfs.lua @@ -143,8 +143,8 @@ vfs.upload = function(path) local r,m = vfs.checkperm(path,"write") if(r) then local uid = ulib.uid(SESSION.user) - local file = m.."/"..REQUEST.query["upload.file"] - ulib.move(REQUEST.query["upload.tmp"], file) + local file = m.."/"..REQUEST["upload.file"] + ulib.move(REQUEST["upload.tmp"], file) ulib.chown(file, uid.id, uid.gid) return true, nil else diff --git a/silk/Router.lua b/silk/Router.lua index ab87b48..78732fc 100644 --- a/silk/Router.lua +++ b/silk/Router.lua @@ -24,7 +24,7 @@ function Router:infer(url) -- c,d,e is parameters -- if user dont provide the url, try to infer it -- from the REQUEST - url = url or REQUEST.query.r or "" + url = url or REQUEST.r or "" url = std.trim(url, "/") local args = explode(url, "/") local data = {