Fixed RPC-API
This commit is contained in:
parent
a0650b4ca9
commit
4a9259586d
1 changed files with 15 additions and 11 deletions
|
@ -33,11 +33,9 @@ function index()
|
||||||
luci.http.status(403, "Forbidden")
|
luci.http.status(403, "Forbidden")
|
||||||
end
|
end
|
||||||
|
|
||||||
if pcall(require, "luci.model.uci") then
|
uci = entry({"rpc", "uci"}, call("rpc_uci"))
|
||||||
uci = entry({"rpc", "uci"}, call("rpc_uci"))
|
uci.sysauth = "root"
|
||||||
uci.sysauth = "root"
|
uci.sysauth_authenticator = authenticator
|
||||||
uci.sysauth_authenticator = authenticator
|
|
||||||
end
|
|
||||||
|
|
||||||
fs = entry({"rpc", "fs"}, call("rpc_fs"))
|
fs = entry({"rpc", "fs"}, call("rpc_fs"))
|
||||||
fs.sysauth = "root"
|
fs.sysauth = "root"
|
||||||
|
@ -46,12 +44,10 @@ function index()
|
||||||
sys = entry({"rpc", "sys"}, call("rpc_sys"))
|
sys = entry({"rpc", "sys"}, call("rpc_sys"))
|
||||||
sys.sysauth = "root"
|
sys.sysauth = "root"
|
||||||
sys.sysauth_authenticator = authenticator
|
sys.sysauth_authenticator = authenticator
|
||||||
|
|
||||||
if pcall(require, "luci.model.ipkg") then
|
ipkg = entry({"rpc", "ipkg"}, call("rpc_ipkg"))
|
||||||
fs = entry({"rpc", "ipkg"}, call("rpc_ipkg"))
|
ipkg.sysauth = "root"
|
||||||
fs.sysauth = "root"
|
ipkg.sysauth_authenticator = authenticator
|
||||||
fs.sysauth_authenticator = authenticator
|
|
||||||
end
|
|
||||||
|
|
||||||
uci = entry({"rpc", "auth"}, call("rpc_auth"))
|
uci = entry({"rpc", "auth"}, call("rpc_auth"))
|
||||||
end
|
end
|
||||||
|
@ -85,6 +81,10 @@ function rpc_auth()
|
||||||
end
|
end
|
||||||
|
|
||||||
function rpc_uci()
|
function rpc_uci()
|
||||||
|
if not pcall(require, "luci.model.uci") then
|
||||||
|
luci.http.status(404, "Not Found")
|
||||||
|
return nil
|
||||||
|
end
|
||||||
local uci = require "luci.controller.rpc.uci"
|
local uci = require "luci.controller.rpc.uci"
|
||||||
local jsonrpc = require "luci.jsonrpc"
|
local jsonrpc = require "luci.jsonrpc"
|
||||||
local http = require "luci.http"
|
local http = require "luci.http"
|
||||||
|
@ -145,6 +145,10 @@ function rpc_sys()
|
||||||
end
|
end
|
||||||
|
|
||||||
function rpc_ipkg()
|
function rpc_ipkg()
|
||||||
|
if not pcall(require, "luci.model.ipkg") then
|
||||||
|
luci.http.status(404, "Not Found")
|
||||||
|
return nil
|
||||||
|
end
|
||||||
local ipkg = require "luci.model.ipkg"
|
local ipkg = require "luci.model.ipkg"
|
||||||
local jsonrpc = require "luci.jsonrpc"
|
local jsonrpc = require "luci.jsonrpc"
|
||||||
local http = require "luci.http"
|
local http = require "luci.http"
|
||||||
|
|
Loading…
Reference in a new issue