summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-rpc/luasrc
diff options
context:
space:
mode:
authorGiovanni Giacobbi <giovanni@giacobbi.net>2021-01-16 15:30:03 +0100
committerHannu Nyman <hannu.nyman@iki.fi>2021-01-20 17:48:16 +0200
commitaf422b192462813150863752f9c300af55df4996 (patch)
treeef07c2f73da55ba53792d792e287674f01ddd535 /modules/luci-mod-rpc/luasrc
parentd3280e6f5df17b799230e229c9472cf8854015ae (diff)
treewide: removed trailing whitespaces and extra newlines in 'modules'
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
Diffstat (limited to 'modules/luci-mod-rpc/luasrc')
-rw-r--r--modules/luci-mod-rpc/luasrc/jsonrpc.lua12
-rw-r--r--modules/luci-mod-rpc/luasrc/jsonrpcbind/uci.lua9
2 files changed, 10 insertions, 11 deletions
diff --git a/modules/luci-mod-rpc/luasrc/jsonrpc.lua b/modules/luci-mod-rpc/luasrc/jsonrpc.lua
index c7f025496d..40fb5048e2 100644
--- a/modules/luci-mod-rpc/luasrc/jsonrpc.lua
+++ b/modules/luci-mod-rpc/luasrc/jsonrpc.lua
@@ -7,7 +7,7 @@ require "luci.json"
function resolve(mod, method)
local path = luci.util.split(method, ".")
-
+
for j=1, #path-1 do
if not type(mod) == "table" then
break
@@ -29,7 +29,7 @@ function handle(tbl, rawsource, ...)
local json = decoder:get()
local response
local success = false
-
+
if stat then
if type(json.method) == "string"
and (not json.params or type(json.params) == "table") then
@@ -56,23 +56,23 @@ end
function reply(jsonrpc, id, res, err)
require "luci.json"
id = id or luci.json.null
-
+
-- 1.0 compatibility
if jsonrpc ~= "2.0" then
jsonrpc = nil
res = res or luci.json.null
err = err or luci.json.null
end
-
+
return {id=id, result=res, error=err, jsonrpc=jsonrpc}
end
function proxy(method, ...)
local res = {luci.util.copcall(method, ...)}
local stat = table.remove(res, 1)
-
+
if not stat then
- return nil, {code=-32602, message="Invalid params.", data=table.remove(res, 1)}
+ return nil, {code=-32602, message="Invalid params.", data=table.remove(res, 1)}
else
if #res <= 1 then
return res[1] or luci.json.null
diff --git a/modules/luci-mod-rpc/luasrc/jsonrpcbind/uci.lua b/modules/luci-mod-rpc/luasrc/jsonrpcbind/uci.lua
index 284801ecf1..6ab6949acb 100644
--- a/modules/luci-mod-rpc/luasrc/jsonrpcbind/uci.lua
+++ b/modules/luci-mod-rpc/luasrc/jsonrpcbind/uci.lua
@@ -29,19 +29,19 @@ function commit(config)
end
function delete(config, ...)
- uci:load(config)
- return uci:delete(config, ...) and uci:save(config)
+ uci:load(config)
+ return uci:delete(config, ...) and uci:save(config)
end
function delete_all(config, ...)
uci:load(config)
- return uci:delete_all(config, ...) and uci:save(config)
+ return uci:delete_all(config, ...) and uci:save(config)
end
function foreach(config, stype)
uci:load(config)
local sections = {}
-
+
return uci:foreach(config, stype, function(section)
table.insert(sections, section)
end) and sections
@@ -80,4 +80,3 @@ function tset(config, ...)
uci:load(config)
return uci:tset(config, ...) and uci:save(config)
end
-