Merge pull request #4471 from Ansuel/ddns-refresh
luci-app-ddns: rework with new ddns changes
This commit is contained in:
commit
d61a1c1241
3 changed files with 780 additions and 583 deletions
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,7 @@ local UCI = require "luci.model.uci"
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local util = require "luci.util"
|
local util = require "luci.util"
|
||||||
|
|
||||||
|
local ddns_package_path = "/usr/share/ddns"
|
||||||
local luci_helper = "/usr/lib/ddns/dynamic_dns_lucihelper.sh"
|
local luci_helper = "/usr/lib/ddns/dynamic_dns_lucihelper.sh"
|
||||||
local srv_name = "ddns-scripts"
|
local srv_name = "ddns-scripts"
|
||||||
|
|
||||||
|
@ -155,6 +156,7 @@ local methods = {
|
||||||
local ipkg = require "luci.model.ipkg"
|
local ipkg = require "luci.model.ipkg"
|
||||||
local uci = UCI.cursor()
|
local uci = UCI.cursor()
|
||||||
local dateformat = uci:get("ddns", "global", "ddns_dateformat") or "%F %R"
|
local dateformat = uci:get("ddns", "global", "ddns_dateformat") or "%F %R"
|
||||||
|
local services_mtime = fs.stat(ddns_package_path .. "/list", 'mtime')
|
||||||
uci:unload("ddns")
|
uci:unload("ddns")
|
||||||
local ver, srv_ver_cmd
|
local ver, srv_ver_cmd
|
||||||
local res = {}
|
local res = {}
|
||||||
|
@ -169,6 +171,7 @@ local methods = {
|
||||||
res['_version'] = ver and #ver > 0 and ver or nil
|
res['_version'] = ver and #ver > 0 and ver or nil
|
||||||
res['_enabled'] = sys.init.enabled("ddns")
|
res['_enabled'] = sys.init.enabled("ddns")
|
||||||
res['_curr_dateformat'] = os.date(dateformat)
|
res['_curr_dateformat'] = os.date(dateformat)
|
||||||
|
res['_services_list'] = services_mtime and os.date(dateformat, services_mtime) or 'NO_LIST'
|
||||||
|
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
"luci": [ "setInitAction" ]
|
"luci": [ "setInitAction" ]
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"/etc/ddns/services": [ "read" ],
|
"/usr/share/ddns/default": [ "list" ],
|
||||||
"/etc/ddns/services_ipv6": [ "read" ],
|
"/usr/share/ddns/default/*": [ "read" ],
|
||||||
|
"/usr/share/ddns/custom": [ "list" ],
|
||||||
|
"/usr/share/ddns/custom/*": [ "read" ],
|
||||||
|
"/usr/share/ddns/list": [ "read" ],
|
||||||
|
"/usr/bin/ddns": [ "exec" ],
|
||||||
"/usr/lib/ddns/dynamic_dns_lucihelper.sh": [ "exec" ]
|
"/usr/lib/ddns/dynamic_dns_lucihelper.sh": [ "exec" ]
|
||||||
},
|
},
|
||||||
"uci": [ "ddns" ]
|
"uci": [ "ddns" ]
|
||||||
|
|
Loading…
Reference in a new issue