X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fcontroller%2Fadmin%2Fnetwork.lua;h=6155c28f1a7a123268bab92a5f1c6e0fc8c0bd20;hp=459b8311e231f38a98a85744edad0ea49e3e81cb;hb=4804facec264a6fddc8b8d6b88fd1aa965227264;hpb=ea46eda74b17919b2d315625de15bd77f8d083b0 diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 459b8311e..6155c28f1 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -38,6 +38,9 @@ function index() local page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil, 16) page.leaf = true + local page = entry({"admin", "network", "wireless_add"}, call("wifi_add"), nil, 16) + page.leaf = true + local page = entry({"admin", "network", "wireless_delete"}, call("wifi_delete"), nil, 16) page.leaf = true end @@ -113,6 +116,26 @@ function wifi_join() end end +function wifi_add() + local dev = luci.http.formvalue("device") + local uci = require "luci.model.uci".cursor() + local wlm = require "luci.model.wireless" + + if dev then + wlm.init(uci) + + local net = wlm:add_network({ + device = dev, + mode = "ap", + ssid = "OpenWrt", + encryption = "none" + }) + + uci:save("wireless") + luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", dev, net:name())) + end +end + function wifi_delete(network) local uci = require "luci.model.uci".cursor() local wlm = require "luci.model.wireless"