diff options
author | Hsing-Wang Liao <kuoruan@gmail.com> | 2016-05-30 14:30:47 +0800 |
---|---|---|
committer | Hsing-Wang Liao <kuoruan@gmail.com> | 2016-05-30 21:27:22 +0800 |
commit | c88aea6277ce7242217eda6115a44f6fedb49e56 (patch) | |
tree | 1a26880f21f79573ed9f96f44e00b69ad9adc6b4 /applications/luci-app-aria2/luasrc/controller | |
parent | c46963613f7f1312dac62e507346777ba6f8d8a6 (diff) |
luci-app-aria2: Add package
LuCI Support for Aria2
Signed-off-by: Hsing-Wang Liao <kuoruan@gmail.com>
Diffstat (limited to 'applications/luci-app-aria2/luasrc/controller')
-rw-r--r-- | applications/luci-app-aria2/luasrc/controller/aria2.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/applications/luci-app-aria2/luasrc/controller/aria2.lua b/applications/luci-app-aria2/luasrc/controller/aria2.lua new file mode 100644 index 000000000..17289305d --- /dev/null +++ b/applications/luci-app-aria2/luasrc/controller/aria2.lua @@ -0,0 +1,42 @@ +--[[ +LuCI - Lua Configuration Interface - aria2 support + +Copyright 2014-2015 nanpuyue <nanpuyue@gmail.com> +Modified by kuoruan <kuoruan@gmail.com> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +]]-- + +module("luci.controller.aria2", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/aria2") then + return + end + + local page = entry({"admin", "services", "aria2"}, cbi("aria2"), _("Aria2 Settings")) + page.dependent = true + + entry({"admin", "services", "aria2", "status"}, call("status")).leaf = true + +end + +function status() + local sys = require "luci.sys" + local ipkg = require "luci.model.ipkg" + local http = require "luci.http" + local uci = require "luci.model.uci".cursor() + + local status = { + running = (sys.call("pidof aria2c > /dev/null") == 0), + yaaw = ipkg.installed("yaaw"), + webui = ipkg.installed("webui-aria2") + } + + http.prepare_content("application/json") + http.write_json(status) +end |