foris 6.11.2 → 6.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019-
|
|
2
|
+
* Copyright (C) 2019-2026 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -10,7 +10,9 @@ import React from "react";
|
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
|
|
12
12
|
import { HELP_TEXTS, HTMODES, BANDS } from "./constants";
|
|
13
|
-
import getEncryptionChoices
|
|
13
|
+
import getEncryptionChoices, {
|
|
14
|
+
getSupportedEncryption,
|
|
15
|
+
} from "./encryptionHelpers";
|
|
14
16
|
import WifiGuestForm from "./WiFiGuestForm";
|
|
15
17
|
import WiFiQRCode from "./WiFiQRCode";
|
|
16
18
|
import PasswordInput from "../../bootstrap/PasswordInput";
|
|
@@ -171,19 +173,27 @@ function DeviceForm({
|
|
|
171
173
|
// Get the last item in the available HT modes for the selected band
|
|
172
174
|
const bestHtmode =
|
|
173
175
|
selectedBand.available_htmodes.slice(-1)[0];
|
|
176
|
+
// The band limits the encryption, both for the
|
|
177
|
+
// main and for the guest network
|
|
174
178
|
const deviceUpdate = {
|
|
175
179
|
band: { $set: value },
|
|
176
180
|
channel: { $set: "0" },
|
|
177
181
|
htmode: { $set: bestHtmode },
|
|
182
|
+
encryption: {
|
|
183
|
+
$set: getSupportedEncryption(
|
|
184
|
+
value,
|
|
185
|
+
formData.encryption
|
|
186
|
+
),
|
|
187
|
+
},
|
|
188
|
+
guest_wifi: {
|
|
189
|
+
encryption: {
|
|
190
|
+
$set: getSupportedEncryption(
|
|
191
|
+
value,
|
|
192
|
+
formData.guest_wifi.encryption
|
|
193
|
+
),
|
|
194
|
+
},
|
|
195
|
+
},
|
|
178
196
|
};
|
|
179
|
-
// The 6 GHz band supports only WPA3, both for the
|
|
180
|
-
// main and for the guest network
|
|
181
|
-
if (value === "6g") {
|
|
182
|
-
deviceUpdate.encryption = { $set: "WPA3" };
|
|
183
|
-
deviceUpdate.guest_wifi = {
|
|
184
|
-
encryption: { $set: "WPA3" },
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
197
|
return {
|
|
188
198
|
devices: {
|
|
189
199
|
[deviceIndex]: deviceUpdate,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019-
|
|
2
|
+
* Copyright (C) 2019-2026 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -9,6 +9,7 @@ import React from "react";
|
|
|
9
9
|
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
|
|
12
|
+
import { getSupportedEncryption } from "./encryptionHelpers";
|
|
12
13
|
import ResetWiFiSettings from "./ResetWiFiSettings";
|
|
13
14
|
import WiFiForm from "./WiFiForm";
|
|
14
15
|
import ForisForm from "../../form/components/ForisForm";
|
|
@@ -43,6 +44,20 @@ function WiFiSettings({ ws, endpoint, resetEndpoint, hasGuestNetwork }) {
|
|
|
43
44
|
function prepData(formData) {
|
|
44
45
|
formData.devices.forEach((device, idx) => {
|
|
45
46
|
formData.devices[idx].channel = device.channel.toString();
|
|
47
|
+
|
|
48
|
+
// A device can be delivered by the API on a band which doesn't
|
|
49
|
+
// support its encryption (e.g. WPA2/3 on 6 GHz). Such a value is not
|
|
50
|
+
// among the choices of the select, so the select falls back to
|
|
51
|
+
// displaying its first choice while the form keeps (and submits) the
|
|
52
|
+
// unsupported one.
|
|
53
|
+
formData.devices[idx].encryption = getSupportedEncryption(
|
|
54
|
+
device.band,
|
|
55
|
+
device.encryption
|
|
56
|
+
);
|
|
57
|
+
formData.devices[idx].guest_wifi.encryption = getSupportedEncryption(
|
|
58
|
+
device.band,
|
|
59
|
+
device.guest_wifi.encryption
|
|
60
|
+
);
|
|
46
61
|
});
|
|
47
62
|
return formData;
|
|
48
63
|
}
|
|
@@ -58,8 +73,20 @@ function prepDataToSubmit(formData) {
|
|
|
58
73
|
return;
|
|
59
74
|
}
|
|
60
75
|
|
|
61
|
-
if (!device.guest_wifi.enabled)
|
|
76
|
+
if (!device.guest_wifi.enabled) {
|
|
62
77
|
formData.devices[idx].guest_wifi = { enabled: false };
|
|
78
|
+
} else {
|
|
79
|
+
formData.devices[idx].guest_wifi.encryption =
|
|
80
|
+
getSupportedEncryption(
|
|
81
|
+
device.band,
|
|
82
|
+
device.guest_wifi.encryption
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
formData.devices[idx].encryption = getSupportedEncryption(
|
|
87
|
+
device.band,
|
|
88
|
+
device.encryption
|
|
89
|
+
);
|
|
63
90
|
|
|
64
91
|
if (device.encryption === "WPA2") {
|
|
65
92
|
delete formData.devices[idx].ieee80211w_disabled;
|
|
@@ -8,13 +8,24 @@
|
|
|
8
8
|
import { ENCRYPTIONMODES } from "./constants";
|
|
9
9
|
|
|
10
10
|
// Both the main and the guest network run on the same radio, so the band
|
|
11
|
-
// limits the encryption choices of both of them.
|
|
11
|
+
// limits the encryption choices of both of them. A custom encryption comes
|
|
12
|
+
// from a hand-made configuration, it's offered on any band to keep the form
|
|
13
|
+
// from rewriting it.
|
|
12
14
|
export default function getEncryptionChoices(band, encryption) {
|
|
15
|
+
const customChoice = encryption === "custom" ? { custom: _("Custom") } : {};
|
|
13
16
|
if (band === "6g") {
|
|
14
|
-
return { WPA3: ENCRYPTIONMODES.WPA3 };
|
|
17
|
+
return { WPA3: ENCRYPTIONMODES.WPA3, ...customChoice };
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
return { ...ENCRYPTIONMODES, ...customChoice };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Encryption the band actually supports. Filtering the choices only hides the
|
|
23
|
+
// unsupported ones from the select, the value itself has to follow the band as
|
|
24
|
+
// well, otherwise the select displays its single WPA3 choice while the form
|
|
25
|
+
// still holds (and submits) e.g. WPA2/3.
|
|
26
|
+
export function getSupportedEncryption(band, encryption) {
|
|
27
|
+
if (band === "6g" && encryption !== "custom") {
|
|
28
|
+
return "WPA3";
|
|
18
29
|
}
|
|
19
|
-
return
|
|
30
|
+
return encryption;
|
|
20
31
|
}
|
package/foris-6.11.3.tgz
ADDED
|
Binary file
|
package/package.json
CHANGED
package/foris-6.11.2.tgz
DELETED
|
Binary file
|