summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-29 15:54:13 +0000
committerSteven Barth <steven@midlink.org>2008-08-29 15:54:13 +0000
commit77756f08b465ba9561d2d45c40633ebcac13702e (patch)
treea73a4e3bfc7f6d3f230930346233931a66cfeab9
parente068351a3f5bf63ed85cd5d67a4a71048c5c0f60 (diff)
Publish luci.model.ipkg via JSON-RPC
-rw-r--r--modules/rpc/luasrc/controller/rpc.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/rpc/luasrc/controller/rpc.lua b/modules/rpc/luasrc/controller/rpc.lua
index 0fcd263f5..fdfbdb38e 100644
--- a/modules/rpc/luasrc/controller/rpc.lua
+++ b/modules/rpc/luasrc/controller/rpc.lua
@@ -45,6 +45,10 @@ function index()
fs.sysauth = "root"
fs.sysauth_authenticator = authenticator
+ fs = entry({"rpc", "ipkg"}, call("rpc_ipkg"))
+ fs.sysauth = "root"
+ fs.sysauth_authenticator = authenticator
+
uci = entry({"rpc", "auth"}, call("rpc_auth"))
end
@@ -135,3 +139,13 @@ function rpc_sys()
http.prepare_content("application/json")
ltn12.pump.all(jsonrpc.handle(sys, http.source()), http.write)
end
+
+function rpc_ipkg()
+ local ipkg = require "luci.model.ipkg"
+ local jsonrpc = require "luci.jsonrpc"
+ local http = require "luci.http"
+ local ltn12 = require "luci.ltn12"
+
+ http.prepare_content("application/json")
+ ltn12.pump.all(jsonrpc.handle(ipkg, http.source()), http.write)
+end