X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-ddns%2Fluasrc%2Fmodel%2Fcbi%2Fddns%2Fdetail.lua;fp=applications%2Fluci-app-ddns%2Fluasrc%2Fmodel%2Fcbi%2Fddns%2Fdetail.lua;h=602bc159af7442872370d1d575f31b85500ffc92;hp=77753c03a7950fa81ce7443f55dbbcaca8002e84;hb=8b0f83264a5d33078eaca1f15de226cc7f984f59;hpb=86c627224091bb4ea6df961470464f5ed1748d07
diff --git a/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua b/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
index 77753c03a..602bc159a 100644
--- a/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
+++ b/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
@@ -5,7 +5,7 @@
-- Licensed to the public under the Apache License 2.0.
local NX = require "nixio"
-local FS = require "nixio.fs"
+local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local UTIL = require "luci.util"
local DISP = require "luci.dispatcher"
@@ -14,21 +14,22 @@ local DTYP = require "luci.cbi.datatypes"
local DDNS = require "luci.tools.ddns" -- ddns multiused functions
-- takeover arguments -- #######################################################
-section = arg[1]
+local section = arg[1]
-- check supported options -- ##################################################
-- saved to local vars here because doing multiple os calls slow down the system
-has_ipv6 = DDNS.check_ipv6() -- IPv6 support
-has_ssl = DDNS.check_ssl() -- HTTPS support
-has_proxy = DDNS.check_proxy() -- Proxy support
-has_dnstcp = DDNS.check_bind_host() -- DNS TCP support
-has_force = has_ssl and has_dnstcp -- Force IP Protocoll
+local has_ipv6 = DDNS.check_ipv6() -- IPv6 support
+local has_ssl = DDNS.check_ssl() -- HTTPS support
+local has_proxy = DDNS.check_proxy() -- Proxy support
+local has_dnstcp = DDNS.check_bind_host() -- DNS TCP support
+local has_force = has_ssl and has_dnstcp -- Force IP Protocoll
-- html constants -- ###########################################################
-font_red = ""
-font_off = ""
-bold_on = ""
-bold_off = ""
+local LFLF = (DDNS.get_theme() == "Bootstrap") and [[
]] or [[]]
+local font_red = ""
+local font_off = ""
+local bold_on = ""
+local bold_off = ""
-- error text constants -- #####################################################
err_ipv6_plain = translate("IPv6 not supported") .. " - " ..
@@ -136,7 +137,10 @@ log_dir = m.uci:get(m.config, "global", "log_dir") or "/var/log/ddns"
-- cbi-section definition -- ###################################################
ns = m:section( NamedSection, section, "service",
translate("Details for") .. ([[: %s]] % section),
- translate("Configure here the details for selected Dynamic DNS service") )
+ translate("Configure here the details for selected Dynamic DNS service.")
+ .. [[
]]
+ .. translate("For detailed information about parameter settings look here.")
+ .. [[]] )
ns.instance = section -- arg [1]
ns:tab("basic", translate("Basic Settings"), nil )
ns:tab("advanced", translate("Advanced Settings"), nil )
@@ -344,7 +348,7 @@ function ush.validate(self, value)
end
elseif (#url > 0) then
return nil, err_tab_basic(self) .. translate("either url or script could be set")
- elseif not FS.access(value) then
+ elseif not NXFS.access(value) then
return nil, err_tab_basic(self) .. translate("File not found")
end
return value
@@ -765,7 +769,7 @@ function ips.validate(self, value)
if (usev6:formvalue(section) == "0" and src4:formvalue(section) ~= "script")
or (usev6:formvalue(section) == "1" and src6:formvalue(section) ~= "script") then
return ""
- elseif not value or not (#value > 0) or not FS.access(split[1], "x") then
+ elseif not value or not (#value > 0) or not NXFS.access(split[1], "x") then
return nil, err_tab_adv(self) ..
translate("not found or not executable - Sample: '/path/to/script.sh'")
else
@@ -855,6 +859,34 @@ function eif6.write(self, section, value)
end
end
+-- IPv4/IPv6 - bind_network -- #################################################
+if has_ssl or ( ( m:get(section, "bind_network") or "" ) ~= "" ) then
+ bnet = ns:taboption("advanced", ListValue, "bind_network",
+ translate("Bind Network") )
+ bnet:depends("ipv4_source", "web")
+ bnet:depends("ipv6_source", "web")
+ bnet.rmempty = true
+ bnet.default = ""
+ bnet:value("", translate("-- default --"))
+ WADM.cbi_add_networks(bnet)
+ function bnet.cfgvalue(self, section)
+ local value = AbstractValue.cfgvalue(self, section)
+ if not has_ssl and value ~= "" then
+ self.description = bold_on .. font_red ..
+ translate("Binding to a specific network not supported") .. font_off .. "
" ..
+ translate("please set to 'default'") .. " !" .. bold_off
+ else
+ self.description = translate("OPTIONAL: Network to use for communication") ..
+ "
" .. translate("Casual users should not change this setting")
+ end
+ return value
+ end
+ function bnet.validate(self, value)
+ if (value ~= "" and has_ssl ) or value == "" then return value end
+ return nil, err_tab_adv(self) .. translate("Binding to a specific network not supported") .. " !"
+ end
+end
+
-- IPv4 + IPv6 - force_ipversion (NEW) -- ######################################
-- optional to force wget/curl and host to use only selected IP version
-- command parameter "-4" or "-6"
@@ -1198,7 +1230,7 @@ lv.inputtitle = translate("Read / Reread log file")
lv.rows = 50
function lv.cfgvalue(self, section)
local lfile=log_dir .. "/" .. section .. ".log"
- if FS.access(lfile) then
+ if NXFS.access(lfile) then
return lfile .. "\n" .. translate("Please press [Read] button")
end
return lfile .. "\n" .. translate("File not found or empty")