diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2019-11-16 11:29:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-16 11:29:50 +0200 |
commit | 2663c3384c24e6006919984a58c7153d01c05813 (patch) | |
tree | 8fef4b383a6606d0d2bcd7950e1ad103ecccc1a1 /applications/luci-app-nextdns/luasrc/controller | |
parent | 8b3325f8e757e1db50f3aef803a010da6f68da3a (diff) | |
parent | 4d702a1cf2277288e87ca02ca976a9a437585501 (diff) |
Merge pull request #3291 from rs/feature_nextdns
luci-app-nextdns: add luci integration for nextdns package
Diffstat (limited to 'applications/luci-app-nextdns/luasrc/controller')
-rw-r--r-- | applications/luci-app-nextdns/luasrc/controller/nextdns.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/applications/luci-app-nextdns/luasrc/controller/nextdns.lua b/applications/luci-app-nextdns/luasrc/controller/nextdns.lua new file mode 100644 index 0000000000..0552981938 --- /dev/null +++ b/applications/luci-app-nextdns/luasrc/controller/nextdns.lua @@ -0,0 +1,32 @@ +-- Copyright 2019 Olivier Poitrey (rs@nextdns.io) +-- This is free software, licensed under the Apache License, Version 2.0 + +module("luci.controller.nextdns", package.seeall) + +local util = require("luci.util") +local i18n = require("luci.i18n") +local templ = require("luci.template") +local http = require("luci.http") + +function index() + if not nixio.fs.access("/etc/config/nextdns") then + return + end + + entry({"admin", "services", "nextdns"}, firstchild(), _("NextDNS"), 60).dependent = false + entry({"admin", "services", "nextdns", "overview"}, cbi("overview", {hideresetbtn=true, hidesavebtn=true}), _("Overview"), 10).leaf = true + entry({"admin", "services", "nextdns", "log"}, template("nextdns/logread"), _("Logs"), 30).leaf = true + + entry({"admin", "services", "nextdns", "logread"}, call("logread"), nil).leaf = true + +end + +function logread() + local content = util.trim(util.exec("logread -e 'nextdns'")) or "" + + if content == "" then + content = "No nextdns related logs yet!" + end + http.write(content) +end + |