Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Adding NOHTMLRENDER build flag #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Download the [Repository](https://github.com/ayushsharma82/AsyncElegantOTA/archi

If you would like to add login to your OTA webpage, then please replace `AsyncElegantOTA.begin(&server);` with `AsyncElegantOTA.begin(&server, "username", "password");`. This will prevent unauthorized requests to your OTA webpage and prevent unauthorized firmware upload to your MCU.

If you want to disable the HTML rendering (either for security purpose or to reduce the memory space used), you can add the build flag `NOHTMLRENDER` during the build.

<br>

<b>Antivirus Issue:</b> If you have an antivirus on your PC with internet security, the progress bar on webpage will instantly show 100% because of request caching by your antivirus software. There is no fix for this unless you want to disable your antivirus or whitelist your local IP addresses in it. ( Same is the case with iOS, safari will cache the outgoing requests )
Expand Down
4 changes: 2 additions & 2 deletions src/AsyncElegantOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void AsyncElegantOtaClass::begin(AsyncWebServer *server, const char* username, c
request->send(200, "application/json", "{\"id\": \""+_id+"\", \"hardware\": \"ESP32\"}");
#endif
});

#ifndef NOHTMLRENDER
_server->on("/update", HTTP_GET, [&](AsyncWebServerRequest *request){
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
Expand All @@ -42,7 +42,7 @@ void AsyncElegantOtaClass::begin(AsyncWebServer *server, const char* username, c
response->addHeader("Content-Encoding", "gzip");
request->send(response);
});

#endif
_server->on("/update", HTTP_POST, [&](AsyncWebServerRequest *request) {
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
Expand Down
2 changes: 2 additions & 0 deletions src/AsyncElegantOTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include "ESPAsyncWebServer.h"
#include "FS.h"

#ifndef NOHTMLRENDER
#include "elegantWebpage.h"
#endif


class AsyncElegantOtaClass{
Expand Down