diff --git a/package/gluon-web-cellular/Makefile b/package/gluon-web-cellular/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8b88ba988d07118f548595b75b092f2086424111 --- /dev/null +++ b/package/gluon-web-cellular/Makefile @@ -0,0 +1,12 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-web-cellular + +include ../gluon.mk + +define Package/gluon-web-cellular + DEPENDS:=+gluon-web-admin + TITLE:=UI for activating cellular WAN +endef + +$(eval $(call BuildPackageGluon,gluon-web-cellular)) diff --git a/package/gluon-web-cellular/i18n/gluon-web-cellular.pot b/package/gluon-web-cellular/i18n/gluon-web-cellular.pot new file mode 100644 index 0000000000000000000000000000000000000000..5b3b8ae0499ea4b83a1eead70dbfd82be9d46be0 --- /dev/null +++ b/package/gluon-web-cellular/i18n/gluon-web-cellular.pot @@ -0,0 +1,37 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "APN" +msgstr "" + +msgid "Cellular" +msgstr "" + +msgid "Enabled" +msgstr "" + +msgid "IPv4" +msgstr "" + +msgid "IPv4/IPv6" +msgstr "" + +msgid "IPv6" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "SIM PIN" +msgstr "" + +msgid "Type" +msgstr "" + +msgid "Username" +msgstr "" + +msgid "" +"You can enable uplink via cellular service. If you decide so, the VPN " +"connection is established using the integrated WWAN modem." +msgstr "" diff --git a/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/controller/admin/cellular.lua b/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/controller/admin/cellular.lua new file mode 100644 index 0000000000000000000000000000000000000000..068647080070bf5db3c4270a1df0fca7f75c67f3 --- /dev/null +++ b/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/controller/admin/cellular.lua @@ -0,0 +1,7 @@ +local platform = require 'gluon.platform' + +package 'gluon-web-cellular' + +if platform.is_cellular_device() then + entry({"admin", "cellular"}, model("admin/cellular"), _("Cellular"), 30) +end diff --git a/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/model/admin/cellular.lua b/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/model/admin/cellular.lua new file mode 100644 index 0000000000000000000000000000000000000000..38a4dd2ccc894f5e3a9e85dae0eeb23c60ffe940 --- /dev/null +++ b/package/gluon-web-cellular/luasrc/lib/gluon/config-mode/model/admin/cellular.lua @@ -0,0 +1,54 @@ +local uci = require("simple-uci").cursor() + +local f = Form(translate("Cellular")) + +local s = f:section(Section, nil, translate( + 'You can enable uplink via cellular service. If you decide so, the VPN connection is established ' + .. 'using the integrated WWAN modem.' +)) + +local enabled = s:option(Flag, "enabled", translate("Enabled")) +enabled.default = uci:get('gluon', 'cellular') and uci:get_bool('gluon', 'cellular', 'enabled') + +local pin = s:option(Value, "pin", translate("SIM PIN")) +pin:depends(enabled, true) +pin.default = uci:get('gluon', 'cellular', 'pin') + +local apn = s:option(Value, "apn", translate("APN")) +apn:depends(enabled, true) +apn.default = uci:get('gluon', 'cellular', 'apn') + +local pdptype = s:option(ListValue, "type", translate("Type")) +pdptype:depends(enabled, true) +pdptype:value("IP", translate("IPv4")) +pdptype:value("IPV6", translate("IPv6")) +pdptype:value("IPV4V6", translate("IPv4/IPv6")) +pdptype.default = uci:get('gluon', 'cellular', 'pdptype') or "IP" + +local username = s:option(Value, "username", translate("Username")) +username:depends(enabled, true) +username.default = uci:get('gluon', 'cellular', 'username') + +local password = s:option(Value, "password", translate("Password")) +password:depends(enabled, true) +password.default = uci:get('gluon', 'cellular', 'password') + +function f:write() + local cellular_enabled = false + if enabled.data then + cellular_enabled = true + end + + uci:section('gluon', 'cellular', 'cellular', { + enabled = cellular_enabled, + apn = apn.data, + pdptype = pdptype.data, + pin = pin.data, + username = username.data, + password = password.data, + }) + + uci:commit('gluon') +end + +return f