diff --git a/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua b/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua index 3594094..745c5b9 100644 --- a/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua +++ b/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua @@ -9,6 +9,12 @@ meshvpn = f:field(Flag, "meshvpn", "Mesh-VPN aktivieren?") meshvpn.default = string.format("%d", uci:get("fastd", "ffhl_mesh_vpn", "enabled")) meshvpn.rmempty = false +tc = f:field(Flag, "tc", "Bandbreitenbegrenzung aktivieren?") +local v = string.format("%d", uci:get_first("ffhl", "bandwidth", "disabled")) +if v == "1" then v = "0" else v = "1" end +tc.default = v +tc.rmempty = false + upstream = f:field(Value, "upstream", "Upstream bandwidth (kbit/s)") upstream.value = uci:get_first("ffhl", "bandwidth", "upstream") downstream = f:field(Value, "downstream", "Downstream bandwidth (kbit/s)") @@ -21,9 +27,13 @@ function f.handle(self, state, data) uci:save("fastd") uci:commit("fastd") + local v = string.format("%d", data.tc) + if v == "1" then v = "0" else v = "1" end + uci:foreach("ffhl", "bandwidth", function(s) uci:set("ffhl", s[".name"], "upstream", data.upstream) uci:set("ffhl", s[".name"], "downstream", data.downstream) + uci:set("ffhl", s[".name"], "disabled", v) end )