disable certificate input fields when W5500 device is used
This commit is contained in:
@@ -393,6 +393,10 @@ int Network::mqttConnectionState()
|
||||
return _mqttConnectionState;
|
||||
}
|
||||
|
||||
bool Network::encryptionSupported()
|
||||
{
|
||||
return _device->supportsEncryption();
|
||||
}
|
||||
|
||||
void Network::publishFloat(const char* prefix, const char* topic, const float value, const uint8_t precision)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
void publishPresenceDetection(char* csv);
|
||||
|
||||
int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed
|
||||
bool encryptionSupported();
|
||||
|
||||
const NetworkDeviceType networkDeviceType();
|
||||
|
||||
|
||||
@@ -599,9 +599,9 @@ void WebCfgServer::buildMqttConfigHtml(String &response)
|
||||
response.concat("<h3>Advanced MQTT and Network Configuration</h3>");
|
||||
response.concat("<table>");
|
||||
printInputField(response, "HASSDISCOVERY", "Home Assistant discovery topic (empty to disable; usually homeassistant)", _preferences->getString(preference_mqtt_hass_discovery).c_str(), 30);
|
||||
printTextarea(response, "MQTTCA", "MQTT SSL CA Certificate (*, optional)", _preferences->getString(preference_mqtt_ca).c_str(), TLS_CA_MAX_SIZE);
|
||||
printTextarea(response, "MQTTCRT", "MQTT SSL Client Certificate (*, optional)", _preferences->getString(preference_mqtt_crt).c_str(), TLS_CERT_MAX_SIZE);
|
||||
printTextarea(response, "MQTTKEY", "MQTT SSL Client Key (*, optional)", _preferences->getString(preference_mqtt_key).c_str(), TLS_KEY_MAX_SIZE);
|
||||
printTextarea(response, "MQTTCA", "MQTT SSL CA Certificate (*, optional)", _preferences->getString(preference_mqtt_ca).c_str(), TLS_CA_MAX_SIZE, _network->encryptionSupported());
|
||||
printTextarea(response, "MQTTCRT", "MQTT SSL Client Certificate (*, optional)", _preferences->getString(preference_mqtt_crt).c_str(), TLS_CERT_MAX_SIZE, _network->encryptionSupported());
|
||||
printTextarea(response, "MQTTKEY", "MQTT SSL Client Key (*, optional)", _preferences->getString(preference_mqtt_key).c_str(), TLS_KEY_MAX_SIZE, _network->encryptionSupported());
|
||||
printDropDown(response, "NWHWDT", "Network hardware detection", String(_preferences->getInt(preference_network_hardware_detect)), getNetworkDetectionOptions());
|
||||
printInputField(response, "RSSI", "RSSI Publish interval (seconds; -1 to disable)", _preferences->getInt(preference_rssi_publish_interval), 6);
|
||||
printInputField(response, "NETTIMEOUT", "Network Timeout until restart (seconds; -1 to disable)", _preferences->getInt(preference_network_timeout), 5);
|
||||
@@ -795,7 +795,8 @@ void WebCfgServer::printTextarea(String& response,
|
||||
const char *token,
|
||||
const char *description,
|
||||
const char *value,
|
||||
const size_t maxLength)
|
||||
const size_t maxLength,
|
||||
const bool enabled)
|
||||
{
|
||||
char maxLengthStr[20];
|
||||
|
||||
@@ -804,7 +805,12 @@ void WebCfgServer::printTextarea(String& response,
|
||||
response.concat("<tr><td>");
|
||||
response.concat(description);
|
||||
response.concat("</td><td>");
|
||||
response.concat(" <TEXTAREA NAME=\"");
|
||||
response.concat(" <TEXTAREA ");
|
||||
if(!enabled)
|
||||
{
|
||||
response.concat("DISABLED");
|
||||
}
|
||||
response.concat(" NAME=\"");
|
||||
response.concat(token);
|
||||
response.concat("\" MAXLENGTH=\"");
|
||||
response.concat(maxLengthStr);
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
void printInputField(String& response, const char* token, const char* description, const char* value, const size_t maxLength, const bool isPassword = false);
|
||||
void printInputField(String& response, const char* token, const char* description, const int value, size_t maxLength);
|
||||
void printCheckBox(String& response, const char* token, const char* description, const bool value);
|
||||
void printTextarea(String& response, const char *token, const char *description, const char *value, const size_t maxLength);
|
||||
void printTextarea(String& response, const char *token, const char *description, const char *value, const size_t maxLength, const bool enabled = true);
|
||||
void printDropDown(String &response, const char *token, const char *description, const String preselectedValue, std::vector<std::pair<String, String>> options);
|
||||
void buildNavigationButton(String& response, const char* caption, const char* targetPath);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
virtual ReconnectStatus reconnect() = 0;
|
||||
virtual void reconfigure() = 0;
|
||||
virtual void printError() = 0;
|
||||
virtual bool supportsEncryption() = 0;
|
||||
|
||||
virtual void update() = 0;
|
||||
|
||||
|
||||
@@ -140,6 +140,10 @@ void W5500Device::printError()
|
||||
Log->println(ESP.getFreeHeap());
|
||||
}
|
||||
|
||||
bool W5500Device::supportsEncryption()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool W5500Device::isConnected()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
virtual void reconfigure();
|
||||
virtual void printError();
|
||||
|
||||
bool supportsEncryption() override;
|
||||
|
||||
virtual void update();
|
||||
|
||||
virtual bool isConnected();
|
||||
|
||||
@@ -118,6 +118,11 @@ void WifiDevice::printError()
|
||||
Log->println(ESP.getFreeHeap());
|
||||
}
|
||||
|
||||
bool WifiDevice::supportsEncryption()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WifiDevice::isConnected()
|
||||
{
|
||||
return WiFi.isConnected();
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
virtual void reconfigure();
|
||||
virtual ReconnectStatus reconnect();
|
||||
virtual void printError();
|
||||
bool supportsEncryption() override;
|
||||
|
||||
virtual void update();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user