gluon-config-mode-mesh-vpn: display tc limits in Mbit/s

This commit is contained in:
Martin Weinelt 2019-05-14 14:19:44 +02:00 committed by Matthias Schiffer
parent fc7c8cb086
commit ada723a0df
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
4 changed files with 26 additions and 20 deletions

View File

@ -10,14 +10,14 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Downstream (kbit/s)"
msgstr "Downstream (kbit/s)"
msgid "Downstream (Mbit/s)"
msgstr "Downstream (Mbit/s)"
msgid "Limit bandwidth"
msgstr "Bandbreite begrenzen"
msgid "Upstream (kbit/s)"
msgstr "Upstream (kbit/s)"
msgid "Upstream (Mbit/s)"
msgstr "Upstream (Mbit/s)"
msgid "Use internet connection (mesh VPN)"
msgstr "Internetverbindung nutzen (Mesh-VPN)"

View File

@ -10,14 +10,14 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Downstream (kbit/s)"
msgstr "Débit déscendant (kbit/s)"
msgid "Downstream (Mbit/s)"
msgstr "Débit déscendant (Mbit/s)"
msgid "Limit bandwidth"
msgstr "Limiter la bande passante"
msgid "Upstream (kbit/s)"
msgstr "Débit ascendant (kbit/s)"
msgid "Upstream (Mbit/s)"
msgstr "Débit ascendant (Mbit/s)"
msgid "Use internet connection (mesh VPN)"
msgstr "Utiliser la connection internet (Mesh-VPN)"

View File

@ -1,13 +1,13 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Downstream (kbit/s)"
msgid "Downstream (Mbit/s)"
msgstr ""
msgid "Limit bandwidth"
msgstr ""
msgid "Upstream (kbit/s)"
msgid "Upstream (Mbit/s)"
msgstr ""
msgid "Use internet connection (mesh VPN)"

View File

@ -36,20 +36,26 @@ return function(form, uci)
uci:set("gluon", "mesh_vpn", "limit_enabled", data)
end
o = s:option(Value, "limit_ingress", pkg_i18n.translate("Downstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("gluon", "mesh_vpn", "limit_ingress")
o.datatype = "uinteger"
function o:write(data)
uci:set("gluon", "mesh_vpn", "limit_ingress", data)
local function div(n, d)
if n then
return n / d
end
end
o = s:option(Value, "limit_egress", pkg_i18n.translate("Upstream (kbit/s)"))
o = s:option(Value, "limit_ingress", pkg_i18n.translate("Downstream (Mbit/s)"))
o:depends(limit, true)
o.default = uci:get("gluon", "mesh_vpn", "limit_egress")
o.datatype = "uinteger"
o.default = div(uci:get("gluon", "mesh_vpn", "limit_ingress"), 1000)
o.datatype = "ufloat"
function o:write(data)
uci:set("gluon", "mesh_vpn", "limit_egress", data)
uci:set("gluon", "mesh_vpn", "limit_ingress", data * 1000)
end
o = s:option(Value, "limit_egress", pkg_i18n.translate("Upstream (Mbit/s)"))
o:depends(limit, true)
o.default = div(uci:get("gluon", "mesh_vpn", "limit_egress"), 1000)
o.datatype = "ufloat"
function o:write(data)
uci:set("gluon", "mesh_vpn", "limit_egress", data * 1000)
end
function s:handle()