From f86d2dece57132730f4c632931739e3d7581af36 Mon Sep 17 00:00:00 2001 From: psyborg55 Date: Sat, 24 Dec 2016 14:44:12 +0100 Subject: [PATCH] mwan3-luci: update to 1.4-5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 2 +- .../usr/lib/lua/luci/controller/mwan3.lua | 9 ++++++ .../cbi/mwan/advanced_wirelessconfig.lua | 32 +++++++++++++++++++ .../luci/view/mwan/advanced_diagnostics.htm | 1 + .../luci/view/mwan/advanced_hotplugscript.htm | 1 + .../luci/view/mwan/advanced_mwanconfig.htm | 1 + .../luci/view/mwan/advanced_networkconfig.htm | 1 + .../view/mwan/advanced_troubleshooting.htm | 9 ++++-- .../view/mwan/advanced_wirelessconfig.htm | 24 ++++++++++++++ 9 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_wirelessconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_wirelessconfig.htm diff --git a/net/mwan3-luci/Makefile b/net/mwan3-luci/Makefile index b4b49ce00a..8c77394da2 100644 --- a/net/mwan3-luci/Makefile +++ b/net/mwan3-luci/Makefile @@ -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 PKG_LICENSE:=GPLv2 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua index bd343608ea..3d5a23dd03 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua @@ -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 index 0000000000..95e9f7c7e5 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_wirelessconfig.lua @@ -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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm index 19615695dd..14d404bc7c 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm @@ -4,6 +4,7 @@
  • "><%:Hotplug Script%>
  • "><%:MWAN Config%>
  • "><%:Network Config%>
  • +
  • "><%:Wireless Config%>
  • "><%:Diagnostics%>
  • "><%:Troubleshooting%>
  • diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm index cbef94b00e..4c2a0dc208 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm @@ -2,6 +2,7 @@
  • "><%:Hotplug Script%>
  • "><%:MWAN Config%>
  • "><%:Network Config%>
  • +
  • "><%:Wireless Config%>
  • "><%:Diagnostics%>
  • "><%:Troubleshooting%>
  • diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm index 5d83bdda43..fba3fa6940 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm @@ -2,6 +2,7 @@
  • "><%:Hotplug Script%>
  • "><%:MWAN Config%>
  • "><%:Network Config%>
  • +
  • "><%:Wireless Config%>
  • "><%:Diagnostics%>
  • "><%:Troubleshooting%>
  • diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm index 5c06d362c9..cf90112078 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm @@ -2,6 +2,7 @@
  • "><%:Hotplug Script%>
  • "><%:MWAN Config%>
  • "><%:Network Config%>
  • +
  • "><%:Wireless Config%>
  • "><%:Diagnostics%>
  • "><%:Troubleshooting%>
  • diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm index 514d91f912..0a12496899 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm @@ -4,6 +4,7 @@
  • "><%:Hotplug Script%>
  • "><%:MWAN Config%>
  • "><%:Network Config%>
  • +
  • "><%:Wireless Config%>
  • "><%:Diagnostics%>
  • "><%:Troubleshooting%>
  • @@ -19,6 +20,7 @@ var versions = 'Software versions :

    '; var mwanConfig = '

    Output of "cat /etc/config/mwan3" :

    '; var netConfig = '

    Output of "cat /etc/config/network" :

    '; + var wifiConfig = '

    Output of "cat /etc/config/wireless" :

    '; var ifconfig = '

    Output of "ifconfig" :

    '; var ipRoute = '

    Output of "route -n" :

    '; var ipRuleShow = '

    Output of "ip rule show" :

    '; @@ -26,10 +28,11 @@ var firewallOut = '

    Firewall default output policy (must be ACCEPT) :

    '; var iptables = '

    Output of "iptables -L -t mangle -v -n" :

    '; tshoot.innerHTML = String.format( - '
    %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s
    ', + '
    %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s
    ', 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 index 0000000000..5077674185 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_wirelessconfig.htm @@ -0,0 +1,24 @@ + + + -- 2.30.2