mwan3-luci: update to 1.4-5 3697/head
authorpsyborg55 <psyborg55@users.noreply.github.com>
Sat, 24 Dec 2016 13:44:12 +0000 (14:44 +0100)
committerGitHub <noreply@github.com>
Sat, 24 Dec 2016 13:44:12 +0000 (14:44 +0100)
Maintainer: @arfett
Compile tested: ramips, xiaomi mini, r49946
Run tested: ramips, xiaomi mini, r49946

Description: Bump to 1.4-5. Added new page for wifi configuration edit, similar how the current network configuration page works.
Also enabled collecting of wifi configuration in troubleshooting page.

Signed-of-by: Tomislav Požega pozega.tomislav@gmail.com
net/mwan3-luci/Makefile
net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_wirelessconfig.lua [new file with mode: 0644]
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_wirelessconfig.htm [new file with mode: 0644]

index b4b49ce00a65518af351f138cfeffaa0fd4d565c..8c77394da2bbacd2752fea1a00a157f6bc002a5d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-mwan3
 PKG_VERSION:=1.4
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
 PKG_LICENSE:=GPLv2
 
index bd343608ea5c970d79b26d2d8dbfca00165a19d0..3d5a23dd03aa15f71788646e9bbbededf0fac1ce 100644 (file)
@@ -51,6 +51,8 @@ function index()
                form("mwan/advanced_mwanconfig"))
        entry({"admin", "network", "mwan", "advanced", "networkconfig"},
                form("mwan/advanced_networkconfig"))
+       entry({"admin", "network", "mwan", "advanced", "wirelessconfig"},
+               form("mwan/advanced_wirelessconfig"))
        entry({"admin", "network", "mwan", "advanced", "diagnostics"},
                template("mwan/advanced_diagnostics"))
        entry({"admin", "network", "mwan", "advanced", "diagnostics_display"},
@@ -270,6 +272,13 @@ function troubleshootingData()
                end
        mArray.netconfig = { networkConfig }
 
+       -- wireless config
+       local wirelessConfig = ut.trim(sys.exec("cat /etc/config/wireless | sed -e 's/.*username.*/     USERNAME HIDDEN/' -e 's/.*password.*/   PASSWORD HIDDEN/' -e 's/.*key.*/        KEY HIDDEN/'"))
+               if wirelessConfig == "" then
+                       wirelessConfig = "No data found"
+               end
+       mArray.wificonfig = { wirelessConfig }
+       
        -- ifconfig
        local ifconfig = ut.trim(sys.exec("ifconfig"))
                if ifconfig == "" then
diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_wirelessconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_wirelessconfig.lua
new file mode 100644 (file)
index 0000000..95e9f7c
--- /dev/null
@@ -0,0 +1,32 @@
+-- ------ 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
index 19615695ddb039f66e2ddfd97b65b1642afe27da..14d404bc7c883327aa87174ef9ebf2c6e6a4bc64 100644 (file)
@@ -4,6 +4,7 @@
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
        <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-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
        <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
 </ul>
index cbef94b00e7cd7f1fbc47b2eedc6af07d8947ec4..4c2a0dc208bc21770df48213675357d04db686ba 100644 (file)
@@ -2,6 +2,7 @@
        <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
        <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-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
 </ul>
index 5d83bdda4302c24265ebff782eca3e11a007a5ea..fba3fa69404c642b8f5eaf5c7b02bbbf17fc8be3 100644 (file)
@@ -2,6 +2,7 @@
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
        <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>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
 </ul>
index 5c06d362c9f92f924ad54c273b283271d7efe145..cf901120784880f72d7414b9e4dadb9fd9812199 100644 (file)
@@ -2,6 +2,7 @@
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
        <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>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
 </ul>
index 514d91f9129f70c8c206adc64a0171e130c6c3b3..0a12496899876b3c7d90b5b32ceef4833d8925b7 100644 (file)
@@ -4,6 +4,7 @@
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
        <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-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
        <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
        <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
 </ul>
@@ -19,6 +20,7 @@
                                var versions = '<span class="description">Software versions : </span><br /><br />';
                                var mwanConfig = '<br /><br /><span class="description">Output of &#34;cat /etc/config/mwan3&#34; : </span><br /><br />';
                                var netConfig = '<br /><br /><span class="description">Output of &#34;cat /etc/config/network&#34; : </span><br /><br />';
+                               var wifiConfig = '<br /><br /><span class="description">Output of &#34;cat /etc/config/wireless&#34; : </span><br /><br />';
                                var ifconfig = '<br /><br /><span class="description">Output of &#34;ifconfig&#34; : </span><br /><br />';
                                var ipRoute = '<br /><br /><span class="description">Output of &#34;route -n&#34; : </span><br /><br />';
                                var ipRuleShow = '<br /><br /><span class="description">Output of &#34;ip rule show&#34; : </span><br /><br />';
                                var firewallOut = '<br /><br /><span class="description">Firewall default output policy (must be ACCEPT) : </span><br /><br />';
                                var iptables = '<br /><br /><span class="description">Output of &#34;iptables -L -t mangle -v -n&#34; : </span><br /><br />';
                                tshoot.innerHTML = String.format(
-                                       '<pre>%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s</pre>',
+                                       '<pre>%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s</pre>',
                                        versions, mArray.versions[0], mwanConfig, mArray.mwanconfig[0], netConfig, mArray.netconfig[0],
-                                       ifconfig, mArray.ifconfig[0], ipRoute, mArray.routeshow[0], ipRuleShow, mArray.iprule[0],
-                                       routeListTable, mArray.routelist[0], firewallOut, mArray.firewallout[0], iptables, mArray.iptables[0]
+                                       wifiConfig, mArray.wificonfig[0], ifconfig, mArray.ifconfig[0], ipRoute, mArray.routeshow[0],
+                                       ipRuleShow, mArray.iprule[0], routeListTable, mArray.routelist[0], firewallOut, mArray.firewallout[0],
+                                       iptables, mArray.iptables[0]
                                );
                        }
                        else
diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_wirelessconfig.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_wirelessconfig.htm
new file mode 100644 (file)
index 0000000..5077674
--- /dev/null
@@ -0,0 +1,24 @@
+<ul class="cbi-tabmenu">
+       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
+       <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>
+       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
+       <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
+</ul>
+
+<style type="text/css">
+  .container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
+       max-width: none;
+       margin: 0px 0px 0px 30px;
+       padding-right: 30px;
+       width: auto;
+  }
+  .cbi-section-node {
+       margin-top: 20px;
+  }
+  .cbi-section {
+       border: 1px dotted #555555;
+       padding: 20px;
+  }
+</style>