summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-simple-adblock/luasrc/controller
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-simple-adblock/luasrc/controller')
-rw-r--r--applications/luci-app-simple-adblock/luasrc/controller/simple-adblock.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/applications/luci-app-simple-adblock/luasrc/controller/simple-adblock.lua b/applications/luci-app-simple-adblock/luasrc/controller/simple-adblock.lua
index 1dbfd1d40c..1c56502480 100644
--- a/applications/luci-app-simple-adblock/luasrc/controller/simple-adblock.lua
+++ b/applications/luci-app-simple-adblock/luasrc/controller/simple-adblock.lua
@@ -8,17 +8,23 @@ end
function simple_adblock_action(name)
local packageName = "simple-adblock"
+ local http = require "luci.http"
+ local sys = require "luci.sys"
+ local uci = require "luci.model.uci".cursor()
+ local util = require "luci.util"
if name == "start" then
- luci.sys.init.start(packageName)
+ sys.init.start(packageName)
elseif name == "action" then
- luci.util.exec("/etc/init.d/" .. packageName .. " dl >/dev/null 2>&1")
+ util.exec("/etc/init.d/" .. packageName .. " dl >/dev/null 2>&1")
elseif name == "stop" then
- luci.sys.init.stop(packageName)
+ sys.init.stop(packageName)
elseif name == "enable" then
- luci.util.exec("uci set " .. packageName .. ".config.enabled=1; uci commit " .. packageName)
+ uci:set(packageName, "config", "enabled", "1")
+ uci:commit(packageName)
elseif name == "disable" then
- luci.util.exec("uci set " .. packageName .. ".config.enabled=0; uci commit " .. packageName)
+ uci:set(packageName, "config", "enabled", "0")
+ uci:commit(packageName)
end
- luci.http.prepare_content("text/plain")
- luci.http.write("0")
+ http.prepare_content("text/plain")
+ http.write("0")
end