mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 18:26:21 +02:00
Merge branch 'feature/newAsyncWebserver' into development03
This commit is contained in:
commit
16869b4e26
4 changed files with 35 additions and 33 deletions
|
@ -1,26 +1,26 @@
|
||||||
diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp
|
diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp
|
||||||
index 6e88da9..09359c3 100644
|
index 88d88ec..cb06fe0 100644
|
||||||
--- a/src/AsyncWebSocket.cpp
|
--- a/src/AsyncWebSocket.cpp
|
||||||
+++ b/src/AsyncWebSocket.cpp
|
+++ b/src/AsyncWebSocket.cpp
|
||||||
@@ -827,7 +827,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer)
|
@@ -745,7 +745,7 @@ void AsyncWebSocketClient::binary(const __FlashStringHelper* data, size_t len) {
|
||||||
|
|
||||||
IPAddress AsyncWebSocketClient::remoteIP() {
|
IPAddress AsyncWebSocketClient::remoteIP() const {
|
||||||
if(!_client) {
|
if (!_client)
|
||||||
- return IPAddress((uint32_t)0);
|
- return IPAddress((uint32_t)0U);
|
||||||
+ return IPAddress();
|
+ return IPAddress();
|
||||||
}
|
|
||||||
return _client->remoteIP();
|
return _client->remoteIP();
|
||||||
}
|
}
|
||||||
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
|
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
|
||||||
index a22e991..babef18 100644
|
index 86aa947..9d0ee00 100644
|
||||||
--- a/src/WebResponses.cpp
|
--- a/src/WebResponses.cpp
|
||||||
+++ b/src/WebResponses.cpp
|
+++ b/src/WebResponses.cpp
|
||||||
@@ -317,7 +317,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
|
@@ -447,7 +447,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest* request, size_t len, u
|
||||||
free(buf);
|
free(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
- outLen = sprintf((char*)buf+headLen, "%x", readLen) + headLen;
|
- outLen = sprintf_P((char*)buf + headLen, PSTR("%x"), readLen) + headLen;
|
||||||
+ outLen = sprintf((char*)buf+headLen, "%04x", readLen) + headLen;
|
+ outLen = sprintf_P((char*)buf + headLen, PSTR("%04x"), readLen) + headLen;
|
||||||
while(outLen < headLen + 4) buf[outLen++] = ' ';
|
while (outLen < headLen + 4)
|
||||||
|
buf[outLen++] = ' ';
|
||||||
buf[outLen++] = '\r';
|
buf[outLen++] = '\r';
|
||||||
buf[outLen++] = '\n';
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ def applyPatch(libName, patchFile):
|
||||||
|
|
||||||
|
|
||||||
# list of patches to apply (relative to /src)
|
# list of patches to apply (relative to /src)
|
||||||
applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch")
|
applyPatch("ESPAsyncWebServer", "../patches/AsyncWeb_Prometheus.patch")
|
||||||
|
|
||||||
if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"):
|
if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"):
|
||||||
applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch")
|
applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch")
|
||||||
|
|
|
@ -26,7 +26,8 @@ extra_scripts =
|
||||||
post:../scripts/add_littlefs_binary.py
|
post:../scripts/add_littlefs_binary.py
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2
|
#https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2
|
||||||
|
https://github.com/mathieucarbou/ESPAsyncWebServer @ ^3.1.3
|
||||||
https://github.com/nRF24/RF24.git#v1.4.8
|
https://github.com/nRF24/RF24.git#v1.4.8
|
||||||
paulstoffregen/Time @ ^1.6.1
|
paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.7.0
|
https://github.com/bertmelis/espMqttClient#v1.7.0
|
||||||
|
@ -51,6 +52,7 @@ lib_deps =
|
||||||
https://github.com/me-no-dev/ESPAsyncUDP
|
https://github.com/me-no-dev/ESPAsyncUDP
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DEMC_MIN_FREE_MEMORY=4096
|
-DEMC_MIN_FREE_MEMORY=4096
|
||||||
|
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
|
||||||
;-Wl,-Map,output.map
|
;-Wl,-Map,output.map
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp8266_exception_decoder
|
esp8266_exception_decoder
|
||||||
|
|
|
@ -245,7 +245,7 @@ class Web {
|
||||||
if (CHECK_MASK(mConfig->sys.protectionMask, mask))
|
if (CHECK_MASK(mConfig->sys.protectionMask, mask))
|
||||||
checkProtection(request);
|
checkProtection(request);
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), zippedHtml, len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), zippedHtml, len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
||||||
if(request->hasParam("v"))
|
if(request->hasParam("v"))
|
||||||
|
@ -343,7 +343,7 @@ class Web {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), login_html, login_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), login_html, login_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ class Web {
|
||||||
checkProtection(request);
|
checkProtection(request);
|
||||||
mApp->lock(true);
|
mApp->lock(true);
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -363,9 +363,9 @@ class Web {
|
||||||
DPRINTLN(DBG_VERBOSE, F("onColor"));
|
DPRINTLN(DBG_VERBOSE, F("onColor"));
|
||||||
AsyncWebServerResponse *response;
|
AsyncWebServerResponse *response;
|
||||||
if (mConfig->sys.darkMode)
|
if (mConfig->sys.darkMode)
|
||||||
response = request->beginResponse_P(200, F("text/css"), colorDark_css, colorDark_css_len);
|
response = request->beginResponse(200, F("text/css"), colorDark_css, colorDark_css_len);
|
||||||
else
|
else
|
||||||
response = request->beginResponse_P(200, F("text/css"), colorBright_css, colorBright_css_len);
|
response = request->beginResponse(200, F("text/css"), colorBright_css, colorBright_css_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
if(request->hasParam("v")) {
|
if(request->hasParam("v")) {
|
||||||
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
||||||
|
@ -375,7 +375,7 @@ class Web {
|
||||||
|
|
||||||
void onCss(AsyncWebServerRequest *request) {
|
void onCss(AsyncWebServerRequest *request) {
|
||||||
DPRINTLN(DBG_VERBOSE, F("onCss"));
|
DPRINTLN(DBG_VERBOSE, F("onCss"));
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/css"), style_css, style_css_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/css"), style_css, style_css_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
if(request->hasParam("v")) {
|
if(request->hasParam("v")) {
|
||||||
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
||||||
|
@ -386,7 +386,7 @@ class Web {
|
||||||
void onApiJs(AsyncWebServerRequest *request) {
|
void onApiJs(AsyncWebServerRequest *request) {
|
||||||
DPRINTLN(DBG_VERBOSE, F("onApiJs"));
|
DPRINTLN(DBG_VERBOSE, F("onApiJs"));
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/javascript"), api_js, api_js_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/javascript"), api_js, api_js_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
if(request->hasParam("v"))
|
if(request->hasParam("v"))
|
||||||
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
||||||
|
@ -396,7 +396,7 @@ class Web {
|
||||||
void onGridInfoJson(AsyncWebServerRequest *request) {
|
void onGridInfoJson(AsyncWebServerRequest *request) {
|
||||||
DPRINTLN(DBG_VERBOSE, F("onGridInfoJson"));
|
DPRINTLN(DBG_VERBOSE, F("onGridInfoJson"));
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("application/json; charset=utf-8"), grid_info_json, grid_info_json_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("application/json; charset=utf-8"), grid_info_json, grid_info_json_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
if(request->hasParam("v"))
|
if(request->hasParam("v"))
|
||||||
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
response->addHeader(F("Cache-Control"), F("max-age=604800"));
|
||||||
|
@ -405,7 +405,7 @@ class Web {
|
||||||
|
|
||||||
void onFavicon(AsyncWebServerRequest *request) {
|
void onFavicon(AsyncWebServerRequest *request) {
|
||||||
static const char favicon_type[] PROGMEM = "image/x-icon";
|
static const char favicon_type[] PROGMEM = "image/x-icon";
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, favicon_type, favicon_ico, favicon_ico_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, favicon_type, favicon_ico, favicon_ico_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ class Web {
|
||||||
|
|
||||||
void onReboot(AsyncWebServerRequest *request) {
|
void onReboot(AsyncWebServerRequest *request) {
|
||||||
mApp->setRebootFlag();
|
mApp->setRebootFlag();
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ class Web {
|
||||||
void showHtml(AsyncWebServerRequest *request) {
|
void showHtml(AsyncWebServerRequest *request) {
|
||||||
checkProtection(request);
|
checkProtection(request);
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ class Web {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), wizard_html, wizard_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), wizard_html, wizard_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
|
@ -635,7 +635,7 @@ class Web {
|
||||||
|
|
||||||
mApp->saveSettings((request->arg("reboot") == "on"));
|
mApp->saveSettings((request->arg("reboot") == "on"));
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), save_html, save_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), save_html, save_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ class Web {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAbout(AsyncWebServerRequest *request) {
|
void onAbout(AsyncWebServerRequest *request) {
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len);
|
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), about_html, about_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
|
||||||
if(request->hasParam("v")) {
|
if(request->hasParam("v")) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue