Extend hostname buffer and WiFiManager param length to DNS max (63)

This commit is contained in:
2026-06-29 00:28:24 +02:00
parent 4d538437bc
commit 11477ae68f
+3 -3
View File
@@ -28,10 +28,10 @@ struct AuthConfig {
char pass[32] = ""; char pass[32] = "";
}; };
static char hostname[32] = HOSTNAME_DEFAULT; static char hostname[64] = HOSTNAME_DEFAULT;
static MqttConfig mqttCfg; static MqttConfig mqttCfg;
static AuthConfig authCfg; static AuthConfig authCfg;
static WiFiManagerParameter hostnameParam("hostname", "Device hostname", hostname, 32); static WiFiManagerParameter hostnameParam("hostname", "Device hostname", hostname, 63);
static WebServer server(80); static WebServer server(80);
static WiFiClient wifiClient; static WiFiClient wifiClient;
static PubSubClient mqttClient(wifiClient); static PubSubClient mqttClient(wifiClient);
@@ -304,7 +304,7 @@ static void handleRoot() {
html += "<div><span>Hostname</span><span>" + String(hostname) + "</span></div>"; html += "<div><span>Hostname</span><span>" + String(hostname) + "</span></div>";
html += "<div><span>IP</span><span>" + WiFi.localIP().toString() + "</span></div></div>"; html += "<div><span>IP</span><span>" + WiFi.localIP().toString() + "</span></div></div>";
html += "<form action=/config method=post>"; html += "<form action=/config method=post>";
html += "<label>Hostname</label><input name=hostname value='" + String(hostname) + "'>"; html += "<label>Hostname</label><input name=hostname maxlength=63 value='" + String(hostname) + "'>";
html += authSection; html += authSection;
html += mqttSection; html += mqttSection;
html += "<button class=btn type=submit>Save</button></form>"; html += "<button class=btn type=submit>Save</button></form>";