Update 'luasrc/model/cbi/easymesh.lua'

pull/1/head
ben 1 year ago
parent 6ee428b15c
commit 633344d114

@ -4,7 +4,7 @@ local m,s,o
local sys = require "luci.sys" local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
m = Map("easymesh", m = Map("easymesh",
translate("Easy Mesh WiFi Setup"), translate("Easy Mesh WiFi Setup"),
translate("Powered by Batman-adv (Better Approach To Mobile Adhoc Networking - Advanced). First setup your Mesh Gateway Server then setup the nodes. When configuring a Mesh Node, first activate your mesh WiFi on the radio device and establish a connection. Then enable it as a DHCP node. The default settings are typically adequate for most Mesh WiFi configurations.") translate("Powered by Batman-adv (Better Approach To Mobile Adhoc Networking - Advanced). First setup your Mesh Gateway Server then setup the nodes. When configuring a Mesh Node, first activate your mesh WiFi on the radio device and establish a connection. Then enable it as a DHCP node. The default settings are typically adequate for most Mesh WiFi configurations.")
.. "<br/>" .. translate("Official website:") .. ' <a href="https://www.open-mesh.org/projects/batman-adv/wiki" target="_blank">https://www.open-mesh.org/projects/batman-adv/wiki</a>' .. "<br/>" .. translate("Official website:") .. ' <a href="https://www.open-mesh.org/projects/batman-adv/wiki" target="_blank">https://www.open-mesh.org/projects/batman-adv/wiki</a>'
@ -43,20 +43,13 @@ v:option(DummyValue, "Neighbor", translate("Neighbor"))
v:option(DummyValue, "lastseen", translate("lastseen")) v:option(DummyValue, "lastseen", translate("lastseen"))
-- Basic -- Basic
s = m:section(TypedSection, "easymesh", translate("Mesh Gateway & Node Settings"), translate("Choose Mesh Gateway or Mesh Node WiFi Settings")) s = m:section(TypedSection, "easymesh", translate("Mesh Gateway & Node WiFi Settings"), translate("Choose Mesh Gateway or Mesh Node WiFi Settings: Begin by completing this section on your mesh server and nodes. Ensure each radio's WiFi network name is consistent. For example: easymesh_AC, easymesh_N."))
s.anonymous = true s.anonymous = true
---- Eanble ---- Eanble
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable Easy Mesh")) o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable Easy Mesh"))
o.default = 0 o.default = 0
o.rmempty = false o.rmempty = false
function o.write(self, section, value)
Flag.write(self, section, value)
-- Run init start
luci.sys.call("uci commit")
luci.sys.call("/etc/init.d/easymesh start")
end
o = s:option(ListValue, "role", translate("Mesh Device Type")) o = s:option(ListValue, "role", translate("Mesh Device Type"))
o:value("off", translate("Mesh Node")) o:value("off", translate("Mesh Node"))
@ -75,7 +68,7 @@ o.rmempty = false
---- mesh ---- mesh
o = s:option(Value, "mesh_id", translate("Mesh ID")) o = s:option(Value, "mesh_id", translate("Mesh ID"))
o.default = "easymesh" o.default = "easymesh_AC"
o.description = translate("Mesh ID") o.description = translate("Mesh ID")
enable = s:option(Flag, "encryption", translate("Encryption"), translate("")) enable = s:option(Flag, "encryption", translate("Encryption"), translate(""))
@ -106,23 +99,38 @@ o.default = "-88"
o.atatype = "range(-1,-120)" o.atatype = "range(-1,-120)"
o:depends("kvr", 1) o:depends("kvr", 1)
---- Apply MESH settings
--ctrl = m:section(TypedSection, "easymesh", "Apply Mesh WiFi Settings to Server or Node")
--ctrl.anonymous = true
--ctrl.addremove = false
----btnStop = ctrl:option(Button, "_btn_start", translate("Apply Mesh WiFi Settings"))
--function btnStop.write()
-- io.popen("/etc/init.d/easymesh start")
--end
---- 802.11F ---- 802.11F
--enable = s:option(Flag, "iapp", translate("inter-access point protocol"), translate("Wireless Access Points (APs) running on different vendors can communicate with each other")) --enable = s:option(Flag, "iapp", translate("inter-access point protocol"), translate("Wireless Access Points (APs) running on different vendors can communicate with each other"))
--enable.default = 0 --enable.default = 0
--enable.rmempty = false --enable.rmempty = false
-- NodeMode -- NodeMode
s = m:section(TypedSection, "easymesh", translate("Enable Router as Mesh Node"), translate("Add Mesh WiFi on Gateway and Node first. Mesh Node will use your gateway for DHCP. ")) s = m:section(TypedSection, "easymesh", translate("Enable Router as DHCP Mesh Node"), translate("Set up Easy Mesh WiFi on your server and nodes first. All mesh nodes will utilize your mesh server for DHCP. "))
s.anonymous = true s.anonymous = true
---- ap_mode ---- ap_mode
enable = s:option(Flag, "ap_mode", translate("Enable as DHCP Mesh Node"), translate("Important: Connect to your mesh gateway WiFi before enabling.")) enable = s:option(Flag, "ap_mode", translate("Enable as DHCP Mesh Node"), translate("Important: Setup your mesh WiFi network before enabling."))
enable.default = 0 enable.default = 0
enable.rmempty = false enable.rmempty = false
---- static ip ---- ip address
--o = s:option(Value, "ipaddr", translate("IPv4-Address")) --o = s:option(Value, "ipaddr", translate("Static IP Address"))
--o.default = "192.168.8.101" --o.default = "192.168.8.2"
--o.datatype = "ip4addr"
--o:depends("ap_mode", 1)
---- o = s:option(Value, "dns", translate("Mesh Server IPv4 DNS"))
--o.default = "192.168.8.1"
--o.datatype = "ip4addr" --o.datatype = "ip4addr"
--o:depends("ap_mode", 1) --o:depends("ap_mode", 1)
@ -131,35 +139,32 @@ enable.rmempty = false
--o.datatype = "ip4addr" --o.datatype = "ip4addr"
--o:depends("ap_mode", 1) --o:depends("ap_mode", 1)
o = s:option(Value, "gateway", translate("Set Hostname for this DHCP Mesh Node")) o = s:option(Value, "gateway", translate("Set Hostname for this Mesh Node"))
o.default = "node1" o.default = "node1"
o.datatype = "string" o.datatype = "string"
o:depends("ap_mode", 1) o:depends("ap_mode", 1)
-- MESH Node Control: Start/Stop DHCP MESH Node -- MESH Node Control: apply mesh settings
ctrl = m:section(TypedSection, "easymesh", "Node Control: Start/Stop Mesh Node") ctrl = m:section(TypedSection, "easymesh", "Click Save Then Enable or Disable Your Mesh WiFi settings")
ctrl.anonymous = true ctrl.anonymous = true
ctrl.addremove = false ctrl.addremove = false
btnStop = ctrl:option(Button, "_btn_start", translate("Enable Mesh Node")) btnStop = ctrl:option(Button, "_btn_start", translate("Enable Easy Mesh"))
function btnStop.write() function btnStop.write()
io.popen("/etc/init.d/easymesh start") io.popen("/etc/init.d/easymesh start")
end end
btnStart = ctrl:option(Button, "_btn_stop", translate("Disable Mesh Node")) btnStart = ctrl:option(Button, "_btn_stop", translate("Disable Easy Mesh"))
function btnStart.write() function btnStart.write()
io.popen("/etc/init.d/easymesh stop") io.popen("/etc/init.d/easymesh stop")
end end
---- o = s:option(Value, "dns", translate("Mesh IPv4 DNS")) function o.write(self, section, value)
--o.default = "192.168.8.1" Flag.write(self, section, value)
--o.datatype = "ip4addr" -- Run init start
--o:depends("ap_mode", 1) luci.sys.call("uci commit")
function m.on_commit(self)
luci.sys.call("uci commit")
luci.sys.call("/etc/init.d/easymesh start &") luci.sys.call("/etc/init.d/easymesh start &")
end end
return m return m
Loading…
Cancel
Save