From: Florian Eckert Date: Thu, 11 Jan 2018 12:31:50 +0000 (+0100) Subject: luci-app-mwan3: remove direct configuration possibility for /etc/config files X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=5aeeb69f15de71fe418d65ca13a73a96c7b6e393;p=project%2Fluci.git luci-app-mwan3: remove direct configuration possibility for /etc/config files With this change it is not longer possible to edit the following configuration files directly. - mwan3 - wireless - network The user should edit the configuration over the provided luci pages. which will do input checks and so prevent from miss configuration. Signed-off-by: Florian Eckert --- diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index 59d77966a5..e8c818ee3d 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -56,16 +56,6 @@ function index() entry({"admin", "network", "mwan", "configuration", "notify"}, cbi("mwan/notify"), _("Notification"), 50).leaf = true - - entry({"admin", "network", "mwan", "advanced"}, - alias("admin", "network", "mwan", "advanced", "mwanconfig"), - _("Advanced"), 100) - entry({"admin", "network", "mwan", "advanced", "mwanconfig"}, - form("mwan/advanced_mwanconfig")) - entry({"admin", "network", "mwan", "advanced", "networkconfig"}, - form("mwan/advanced_networkconfig")) - entry({"admin", "network", "mwan", "advanced", "wirelessconfig"}, - form("mwan/advanced_wirelessconfig")) end function getInterfaceStatus(ruleNumber, interfaceName) diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua deleted file mode 100644 index e0a99e8366..0000000000 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua +++ /dev/null @@ -1,32 +0,0 @@ --- ------ mwan configuration ------ -- - -ut = require "luci.util" - -mwanConfig = "/etc/config/mwan3" - - -m5 = SimpleForm("luci", nil) - m5:append(Template("mwan/advanced_mwanconfig")) -- highlight current tab - - -f = m5:section(SimpleSection, nil, - translate("This section allows you to modify the contents of /etc/config/mwan3")) - -t = f:option(TextValue, "lines") - t.rmempty = true - t.rows = 20 - - function t.cfgvalue() - return nixio.fs.readfile(mwanConfig) or "" - end - - function t.write(self, section, data) -- format and write new data to script - return nixio.fs.writefile(mwanConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") - end - - function f.handle(self, state, data) - return true - end - - -return m5 diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_networkconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_networkconfig.lua deleted file mode 100644 index b93d89751b..0000000000 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_networkconfig.lua +++ /dev/null @@ -1,32 +0,0 @@ --- ------ network configuration ------ -- - -ut = require "luci.util" - -networkConfig = "/etc/config/network" - - -m5 = SimpleForm("networkconf", nil) - m5:append(Template("mwan/advanced_networkconfig")) -- highlight current tab - - -f = m5:section(SimpleSection, nil, - translate("This section allows you to modify the contents of /etc/config/network")) - -t = f:option(TextValue, "lines") - t.rmempty = true - t.rows = 20 - - function t.cfgvalue() - return nixio.fs.readfile(networkConfig) or "" - end - - function t.write(self, section, data) -- format and write new data to script - return nixio.fs.writefile(networkConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") - end - - function f.handle(self, state, data) - return true - end - - -return m5 diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_wirelessconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_wirelessconfig.lua deleted file mode 100644 index 95e9f7c7e5..0000000000 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_wirelessconfig.lua +++ /dev/null @@ -1,32 +0,0 @@ --- ------ wireless configuration ------ -- - -ut = require "luci.util" - -wirelessConfig = "/etc/config/wireless" - - -m5 = SimpleForm("wirelessconf", nil) - m5:append(Template("mwan/advanced_wirelessconfig")) -- highlight current tab - - -f = m5:section(SimpleSection, nil, - translate("This section allows you to modify the contents of /etc/config/wireless")) - -t = f:option(TextValue, "lines") - t.rmempty = true - t.rows = 20 - - function t.cfgvalue() - return nixio.fs.readfile(wirelessConfig) or "" - end - - function t.write(self, section, data) -- format and write new data to script - return nixio.fs.writefile(wirelessConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") - end - - function f.handle(self, state, data) - return true - end - - -return m5 diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_mwanconfig.htm b/applications/luci-app-mwan3/luasrc/view/mwan/advanced_mwanconfig.htm deleted file mode 100644 index da73f234dc..0000000000 --- a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_mwanconfig.htm +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_networkconfig.htm b/applications/luci-app-mwan3/luasrc/view/mwan/advanced_networkconfig.htm deleted file mode 100644 index 3295328276..0000000000 --- a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_networkconfig.htm +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_wirelessconfig.htm b/applications/luci-app-mwan3/luasrc/view/mwan/advanced_wirelessconfig.htm deleted file mode 100644 index 10a0eafc16..0000000000 --- a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_wirelessconfig.htm +++ /dev/null @@ -1,11 +0,0 @@ - - -