web-private-ap: init

This commit is contained in:
Maciej Krüger 2022-04-07 16:49:45 +02:00 committed by Alexander List
parent 185d57f458
commit e47f42d811
6 changed files with 260 additions and 0 deletions

View File

@ -0,0 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-private-ap
include ../gluon.mk
define Package/gluon-web-private-ap
DEPENDS:=+gluon-web-admin +gluon-private-ap
TITLE:=UI for activating a private AP
endef
$(eval $(call BuildPackageGluon,gluon-web-private-ap))

View File

@ -0,0 +1,59 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-05-04 02:25+0200\n"
"Last-Translator: <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "8-63 characters"
msgstr "8-63 Zeichen"
msgid "Disabled"
msgstr "Deaktiviert"
msgid "Enabled"
msgstr "Aktiviert"
msgid "Encryption"
msgstr "Verschlüsselung"
msgid "Key"
msgstr "Schlüssel"
msgid "Management Frame Protection"
msgstr ""
msgid "Name (SSID)"
msgstr "Name (SSID)"
msgid "Optional"
msgstr ""
msgid "Private WLAN"
msgstr "Privates WLAN"
msgid "Required"
msgstr "Aktiviert"
msgid "WPA2"
msgstr ""
msgid "WPA2 / WPA3"
msgstr ""
msgid "WPA3"
msgstr ""
msgid ""
"Your node can additionally offer a private client access point "
"which allows you to use the mesh like regular private wifi "
"with your own network, LAN addresses, password, etc."
msgstr ""
"Dein Knoten kann zusätzlich einen privaten Klient Zugangspunkt anbieten. "
"Das erlaubt dir das mesh wie ein normales Privat-WLAN zu verwenden, "
"das ein eigenes Netz, eigene LAN-Addressesn, ein eigens Passwort, etc hat."

View File

@ -0,0 +1,50 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-19 23:30+0100\n"
"Last-Translator:Tobias Bernot <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "8-63 characters"
msgstr "8-63 charactères"
msgid "Disabled"
msgstr ""
msgid "Enabled"
msgstr "Activé"
msgid "Encryption"
msgstr ""
msgid "Key"
msgstr "Clé"
msgid "Management Frame Protection"
msgstr ""
msgid "Name (SSID)"
msgstr "Nom (SSID)"
msgid "Optional"
msgstr ""
msgid "Private WLAN"
msgstr "Wi-Fi privé"
msgid "Required"
msgstr ""
msgid "WPA2"
msgstr ""
msgid "WPA2 / WPA3"
msgstr ""
msgid "WPA3"
msgstr ""

View File

@ -0,0 +1,47 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "8-63 characters"
msgstr ""
msgid "Disabled"
msgstr ""
msgid "Enabled"
msgstr ""
msgid "Encryption"
msgstr ""
msgid "Key"
msgstr ""
msgid "Management Frame Protection"
msgstr ""
msgid "Name (SSID)"
msgstr ""
msgid "Optional"
msgstr ""
msgid "Private WLAN"
msgstr ""
msgid "Required"
msgstr ""
msgid "WPA2"
msgstr ""
msgid "WPA2 / WPA3"
msgstr ""
msgid "WPA3"
msgstr ""
msgid ""
"Your node can additionally offer a private client access point "
"which allows you to use the mesh like regular private wifi "
"with your own network, LAN addresses, password, etc."
msgstr ""

View File

@ -0,0 +1,8 @@
local uci = require("simple-uci").cursor()
local wireless = require 'gluon.wireless'
package 'gluon-web-private-ap'
if wireless.device_uses_wlan(uci) then
entry({"admin", "privatewifi"}, model("admin/privateap"), _("Private AP"), 30)
end

View File

@ -0,0 +1,84 @@
local uci = require("simple-uci").cursor()
local wireless = require 'gluon.wireless'
-- where to read the configuration from
local primary_iface = 'ap_radio0'
local f = Form(translate("Private AP"))
local s = f:section(Section, nil, translate(
'Your node can additionally offer a private client access point '
.. 'which allows you to use the mesh like regular private wifi '
.. 'with your own network, LAN addresses, password, etc.'
))
local enabled = s:option(Flag, "enabled", translate("Enabled"))
enabled.default = uci:get('wireless', primary_iface) and not uci:get_bool('wireless', primary_iface, "disabled")
local ssid = s:option(Value, "ssid", translate("Name (SSID)"))
ssid:depends(enabled, true)
ssid.datatype = "maxlength(32)"
ssid.default = uci:get('wireless', primary_iface, "ssid")
local key = s:option(Value, "key", translate("Key"), translate("8-63 characters"))
key:depends(enabled, true)
key.datatype = "wpakey"
key.default = uci:get('wireless', primary_iface, "key")
local encryption = s:option(ListValue, "encryption", translate("Encryption"))
encryption:depends(enabled, true)
encryption:value("psk2", translate("WPA2"))
if wireless.device_supports_wpa3() then
encryption:value("psk3-mixed", translate("WPA2 / WPA3"))
encryption:value("psk3", translate("WPA3"))
end
encryption.default = uci:get('wireless', primary_iface, 'encryption') or "psk2"
local mfp = s:option(ListValue, "mfp", translate("Management Frame Protection"))
mfp:depends(enabled, true)
mfp:value("0", translate("Disabled"))
if wireless.device_supports_mfp(uci) then
mfp:value("1", translate("Optional"))
mfp:value("2", translate("Required"))
end
mfp.default = uci:get('wireless', primary_iface, 'ieee80211w') or "0"
-- TODO: ipv4 when prefix4() set? or always? allow custom cidr
-- TODO: allow mesh (regular meshing) on private net?
function f:write()
wireless.foreach_radio(uci, function(radio, index)
local radio_name = radio['.name']
local suffix = radio_name:match('^radio(%d+)$')
local name = "ap_" .. radio_name
if enabled.data then
local macaddr = wireless.get_wlan_mac(uci, radio, index, 5)
uci:section('wireless', 'wifi-iface', name, {
device = radio_name,
network = 'ap',
mode = 'ap',
encryption = encryption.data,
ssid = ssid.data,
key = key.data,
macaddr = macaddr,
ifname = suffix and 'ap' .. suffix,
disabled = false,
})
-- hostapd-mini won't start in case 802.11w is configured
if wireless.device_supports_mfp(uci) then
uci:set('wireless', name, 'ieee80211w', mfp.data)
else
uci:delete('wireless', name, 'ieee80211w')
end
else
uci:set('wireless', name, "disabled", true)
end
end)
uci:commit('wireless')
end
return f