summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-10-31 17:27:36 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-01 12:03:33 +0100
commit6aa4b83f2460ff6fe989b39675ce0b001c05ddae (patch)
tree064c1d56b1fd6523402d7ea70bda22dfda827a6c /modules
parent650d7f64d5b1b76d58b6c719e9efe15270468cc8 (diff)
luci-mod-network: wireless.js: issue wifi restart via file/exec rpc call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json1
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js9
-rw-r--r--modules/luci-mod-network/luasrc/controller/admin/network.lua13
3 files changed, 5 insertions, 18 deletions
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index 880a633947..cd37f4d49f 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -64,6 +64,7 @@
"/sbin/firstboot": [ "exec" ],
"/sbin/reboot": [ "exec" ],
"/sbin/sysupgrade": [ "exec" ],
+ "/sbin/wifi": [ "exec" ],
"/bin/tar": [ "exec" ],
"/bin/umount": [ "exec" ],
"/tmp/backup.tar.gz": [ "write" ],
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
index 194b2a3df9..847a712c30 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
@@ -1,4 +1,5 @@
'use strict';
+'require fs';
'require rpc';
'require uci';
'require form';
@@ -1908,11 +1909,9 @@ return L.view.extend({
if (dsc.getAttribute('restart') == '') {
dsc.setAttribute('restart', '1');
- tasks.push(L.Request.post(
- L.url('admin/network/wireless_reconnect', section_ids[i]),
- 'token=' + L.env.token,
- { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
- ).catch(function() {}));
+ tasks.push(fs.exec('/sbin/wifi', ['up', section_ids[i]]).catch(function(e) {
+ L.ui.addNotification(null, E('p', e.message));
+ }));
}
else if (dsc.getAttribute('restart') == '1') {
dsc.removeAttribute('restart');
diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua
index 662fe8cf88..49ed78a0ea 100644
--- a/modules/luci-mod-network/luasrc/controller/admin/network.lua
+++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua
@@ -31,9 +31,6 @@ function index()
end)
if has_wifi then
- page = entry({"admin", "network", "wireless_reconnect"}, post("wifi_reconnect"), nil)
- page.leaf = true
-
page = entry({"admin", "network", "wireless"}, view("network/wireless"), _('Wireless'), 15)
page.leaf = true
end
@@ -158,16 +155,6 @@ function iface_down(iface, force)
luci.http.status(404, "No such interface")
end
-function wifi_reconnect(radio)
- local rc = luci.sys.call("env -i /sbin/wifi up %s >/dev/null" % luci.util.shellquote(radio))
-
- if rc == 0 then
- luci.http.status(200, "Reconnected")
- else
- luci.http.status(500, "Error")
- end
-end
-
function diag_command(cmd, addr)
if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then
luci.http.prepare_content("text/plain")