luci-app-mwan3: remove direct configuration possibility for /etc/config files
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 11 Jan 2018 12:31:50 +0000 (13:31 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Thu, 11 Jan 2018 13:46:39 +0000 (14:46 +0100)
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 <fe@dev.tdt.de>
applications/luci-app-mwan3/luasrc/controller/mwan3.lua
applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua [deleted file]
applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_networkconfig.lua [deleted file]
applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_wirelessconfig.lua [deleted file]
applications/luci-app-mwan3/luasrc/view/mwan/advanced_mwanconfig.htm [deleted file]
applications/luci-app-mwan3/luasrc/view/mwan/advanced_networkconfig.htm [deleted file]
applications/luci-app-mwan3/luasrc/view/mwan/advanced_wirelessconfig.htm [deleted file]

index 59d77966a523ca37af6138bb5de0591c2ce3ee8e..e8c818ee3d40e39ad812b16103abb55d81f8ae50 100644 (file)
@@ -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 (file)
index e0a99e8..0000000
+++ /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 (file)
index b93d897..0000000
+++ /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 (file)
index 95e9f7c..0000000
+++ /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 (file)
index da73f23..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<ul class="cbi-tabmenu">
-       <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
-</ul>
-
-<style type="text/css">
-  .cbi-section {
-       padding: 20px;
-  }
-</style>
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 (file)
index 3295328..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<ul class="cbi-tabmenu">
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
-       <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
-</ul>
-
-<style type="text/css">
-  .cbi-section {
-       padding: 20px;
-  }
-</style>
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 (file)
index 10a0eaf..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<ul class="cbi-tabmenu">
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
-       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
-       <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
-</ul>
-
-<style type="text/css">
-  .cbi-section {
-       padding: 20px;
-  }
-</style>