mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Make gateway optional - #682
This commit is contained in:
@@ -155,8 +155,8 @@ class NetworkSettingsForm extends React.Component<NetworkStatusFormProps> {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
/>
|
/>
|
||||||
<TextValidator
|
<TextValidator
|
||||||
validators={['required', 'isIP']}
|
validators={['isOptionalIP']}
|
||||||
errorMessages={['Gateway IP is required', 'Must be an IP address']}
|
errorMessages={['Must be an IP address']}
|
||||||
name="gateway_ip"
|
name="gateway_ip"
|
||||||
label="Gateway"
|
label="Gateway"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -29,9 +29,13 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
|
|||||||
root["bssid"] = WiFi.BSSIDstr();
|
root["bssid"] = WiFi.BSSIDstr();
|
||||||
root["channel"] = WiFi.channel();
|
root["channel"] = WiFi.channel();
|
||||||
root["subnet_mask"] = WiFi.subnetMask().toString();
|
root["subnet_mask"] = WiFi.subnetMask().toString();
|
||||||
root["gateway_ip"] = WiFi.gatewayIP().toString();
|
|
||||||
IPAddress dnsIP1 = WiFi.dnsIP(0);
|
if (WiFi.gatewayIP() != INADDR_NONE) {
|
||||||
IPAddress dnsIP2 = WiFi.dnsIP(1);
|
root["gateway_ip"] = WiFi.gatewayIP().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress dnsIP1 = WiFi.dnsIP(0);
|
||||||
|
IPAddress dnsIP2 = WiFi.dnsIP(1);
|
||||||
if (dnsIP1 != INADDR_NONE) {
|
if (dnsIP1 != INADDR_NONE) {
|
||||||
root["dns_ip_1"] = dnsIP1.toString();
|
root["dns_ip_1"] = dnsIP1.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user