diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index 90fd8b0..c47f50a 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -3,6 +3,7 @@ #include "NodeDB.h" #include "graphics/Screen.h" #include "main.h" +#include "mesh/http/MeshtasticTlsCertificate.h" #include "mesh/http/WebServer.h" #include "mesh/wifi/WiFiAPClient.h" #include "sleep.h" @@ -52,9 +53,9 @@ using namespace httpsserver; static const uint32_t ACTIVE_THRESHOLD_MS = 5000; static const uint32_t MEDIUM_THRESHOLD_MS = 30000; -static const int32_t ACTIVE_INTERVAL_MS = 50; -static const int32_t MEDIUM_INTERVAL_MS = 200; -static const int32_t IDLE_INTERVAL_MS = 1000; +static const int32_t ACTIVE_INTERVAL_MS = 20; +static const int32_t MEDIUM_INTERVAL_MS = 50; +static const int32_t IDLE_INTERVAL_MS = 50; // Maximum concurrent HTTPS connections (reduced from default 4 to save memory) static const uint8_t MAX_HTTPS_CONNECTIONS = 2; @@ -97,6 +98,12 @@ static void taskCreateCert(void *parameter) { prefs.begin("MeshtasticHTTPS", false); + // Provision the CA-signed meshtastic.local certificate into the same NVS + // keys used by the stock firmware. The certificate survives later OTA + // upgrades back to an unmodified Meshtastic build. + prefs.putBytes("PK", meshtasticTlsPrivateKeyDer, sizeof(meshtasticTlsPrivateKeyDer)); + prefs.putBytes("cert", meshtasticTlsCertificateDer, sizeof(meshtasticTlsCertificateDer)); + #if 0 // Delete the saved certs (used in debugging) LOG_DEBUG("Delete any saved SSL keys");