diff --git a/README.md b/README.md index ec14bda..d3d3cf9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # In this fork -- SPIFFSEditor improvements +- SPIFFSEditor modifications - Added [extras](https://github.com/lorol/ESPAsyncWebServer/tree/master/extras) folder with (Win) tools for re-packing, editing, updating and compressing html to binary arrays embedded to source - Added a [SmartSwitch](https://github.com/lorol/ESPAsyncWebServer/tree/master/examples/SmartSwitch) example to test code features - Applied the memory optimizations from [sascha432](https://github.com/sascha432/ESPAsyncWebServer) fork @@ -9,7 +9,7 @@ - [Additions to this README.md from jendakol' PR](https://github.com/me-no-dev/ESPAsyncWebServer/pull/770) - [Respond with file content using a callback and extra headers](#respond-with-file-content-using-a-callback-and-extra-headers) - [Serving static files by custom handling](#serving-static-files-by-custom-handling) - - Added LittleFS choice for both [esp8266](https://github.com/esp8266/Arduino/tree/master/libraries/LittleFS) / [esp32](https://github.com/lorol/LITTLEFS) , see [SmartSwitch](https://github.com/lorol/ESPAsyncWebServer/blob/master/examples/SmartSwitch/SmartSwitch.ino#L16 ) + - Added LittleFS choice for both [esp8266](https://github.com/esp8266/Arduino/tree/master/libraries/LittleFS) / [esp32](https://github.com/lorol/LITTLEFS) , and FatFS tests for esp32 see [SmartSwitch](https://github.com/lorol/ESPAsyncWebServer/blob/master/examples/SmartSwitch/SmartSwitch.ino#L16 ) ------------------------------------------------------------------------------------------ # ESPAsyncWebServer diff --git a/examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino b/examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino index b12106b..dab2f06 100644 --- a/examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino +++ b/examples/ESP_AsyncFSBrowser/ESP_AsyncFSBrowser.ino @@ -1,234 +1,248 @@ -#define USE_LittleFS // possible only for ESP8266 for now - -#include - -#ifdef ESP32 - #include - #ifdef USE_LittleFS - #define SPIFFS LITTLEFS - #include - #else - #include - #endif - #include - #include - #include -#elif defined(ESP8266) - #ifdef USE_LittleFS - #include - #define SPIFFS LittleFS - #include - #endif -#include -#include -#include -#endif -#include -#include - -// SKETCH BEGIN -AsyncWebServer server(80); -AsyncWebSocket ws("/ws"); -AsyncEventSource events("/events"); - -void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len){ - if(type == WS_EVT_CONNECT){ - Serial.printf("ws[%s][%u] connect\n", server->url(), client->id()); - client->printf("Hello Client %u :)", client->id()); - client->ping(); - } else if(type == WS_EVT_DISCONNECT){ - Serial.printf("ws[%s][%u] disconnect\n", server->url(), client->id()); - } else if(type == WS_EVT_ERROR){ - Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data); - } else if(type == WS_EVT_PONG){ - Serial.printf("ws[%s][%u] pong[%u]: %s\n", server->url(), client->id(), len, (len)?(char*)data:""); - } else if(type == WS_EVT_DATA){ - AwsFrameInfo * info = (AwsFrameInfo*)arg; - String msg = ""; - if(info->final && info->index == 0 && info->len == len){ - //the whole message is in a single frame and we got all of it's data - Serial.printf("ws[%s][%u] %s-message[%llu]: ", server->url(), client->id(), (info->opcode == WS_TEXT)?"text":"binary", info->len); - - if(info->opcode == WS_TEXT){ - for(size_t i=0; i < info->len; i++) { - msg += (char) data[i]; - } - } else { - char buff[3]; - for(size_t i=0; i < info->len; i++) { - sprintf(buff, "%02x ", (uint8_t) data[i]); - msg += buff ; - } - } - Serial.printf("%s\n",msg.c_str()); - - if(info->opcode == WS_TEXT) - client->text("I got your text message"); - else - client->binary("I got your binary message"); - } else { - //message is comprised of multiple frames or the frame is split into multiple packets - if(info->index == 0){ - if(info->num == 0) - Serial.printf("ws[%s][%u] %s-message start\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary"); - Serial.printf("ws[%s][%u] frame[%u] start[%llu]\n", server->url(), client->id(), info->num, info->len); - } - - Serial.printf("ws[%s][%u] frame[%u] %s[%llu - %llu]: ", server->url(), client->id(), info->num, (info->message_opcode == WS_TEXT)?"text":"binary", info->index, info->index + len); - - if(info->opcode == WS_TEXT){ - for(size_t i=0; i < len; i++) { - msg += (char) data[i]; - } - } else { - char buff[3]; - for(size_t i=0; i < len; i++) { - sprintf(buff, "%02x ", (uint8_t) data[i]); - msg += buff ; - } - } - Serial.printf("%s\n",msg.c_str()); - - if((info->index + len) == info->len){ - Serial.printf("ws[%s][%u] frame[%u] end[%llu]\n", server->url(), client->id(), info->num, info->len); - if(info->final){ - Serial.printf("ws[%s][%u] %s-message end\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary"); - if(info->message_opcode == WS_TEXT) - client->text("I got your text message"); - else - client->binary("I got your binary message"); - } - } - } - } -} - - -const char* ssid = "*******"; -const char* password = "*******"; -const char * hostName = "esp-async"; -const char* http_username = "admin"; -const char* http_password = "admin"; - -void setup(){ - Serial.begin(115200); - Serial.setDebugOutput(true); - WiFi.mode(WIFI_AP_STA); - WiFi.softAP(hostName); - WiFi.begin(ssid, password); - if (WiFi.waitForConnectResult() != WL_CONNECTED) { - Serial.printf("STA: Failed!\n"); - WiFi.disconnect(false); - delay(1000); - WiFi.begin(ssid, password); - } - - //Send OTA events to the browser - ArduinoOTA.onStart([]() { events.send("Update Start", "ota"); }); - ArduinoOTA.onEnd([]() { events.send("Update End", "ota"); }); - ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { - char p[32]; - sprintf(p, "Progress: %u%%\n", (progress/(total/100))); - events.send(p, "ota"); - }); - ArduinoOTA.onError([](ota_error_t error) { - if(error == OTA_AUTH_ERROR) events.send("Auth Failed", "ota"); - else if(error == OTA_BEGIN_ERROR) events.send("Begin Failed", "ota"); - else if(error == OTA_CONNECT_ERROR) events.send("Connect Failed", "ota"); - else if(error == OTA_RECEIVE_ERROR) events.send("Recieve Failed", "ota"); - else if(error == OTA_END_ERROR) events.send("End Failed", "ota"); - }); - ArduinoOTA.setHostname(hostName); - ArduinoOTA.begin(); - - MDNS.addService("http","tcp",80); - - SPIFFS.begin(); - - ws.onEvent(onWsEvent); - server.addHandler(&ws); - - events.onConnect([](AsyncEventSourceClient *client){ - client->send("hello!",NULL,millis(),1000); - }); - server.addHandler(&events); - -#ifdef ESP32 - server.addHandler(new SPIFFSEditor(SPIFFS, http_username,http_password)); -#elif defined(ESP8266) - server.addHandler(new SPIFFSEditor(http_username,http_password)); -#endif - - server.on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/plain", String(ESP.getFreeHeap())); - }); - - server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm"); - - server.onNotFound([](AsyncWebServerRequest *request){ - Serial.printf("NOT_FOUND: "); - if(request->method() == HTTP_GET) - Serial.printf("GET"); - else if(request->method() == HTTP_POST) - Serial.printf("POST"); - else if(request->method() == HTTP_DELETE) - Serial.printf("DELETE"); - else if(request->method() == HTTP_PUT) - Serial.printf("PUT"); - else if(request->method() == HTTP_PATCH) - Serial.printf("PATCH"); - else if(request->method() == HTTP_HEAD) - Serial.printf("HEAD"); - else if(request->method() == HTTP_OPTIONS) - Serial.printf("OPTIONS"); - else - Serial.printf("UNKNOWN"); - Serial.printf(" http://%s%s\n", request->host().c_str(), request->url().c_str()); - - if(request->contentLength()){ - Serial.printf("_CONTENT_TYPE: %s\n", request->contentType().c_str()); - Serial.printf("_CONTENT_LENGTH: %u\n", request->contentLength()); - } - - int headers = request->headers(); - int i; - for(i=0;igetHeader(i); - Serial.printf("_HEADER[%s]: %s\n", h->name().c_str(), h->value().c_str()); - } - - int params = request->params(); - for(i=0;igetParam(i); - if(p->isFile()){ - Serial.printf("_FILE[%s]: %s, size: %u\n", p->name().c_str(), p->value().c_str(), p->size()); - } else if(p->isPost()){ - Serial.printf("_POST[%s]: %s\n", p->name().c_str(), p->value().c_str()); - } else { - Serial.printf("_GET[%s]: %s\n", p->name().c_str(), p->value().c_str()); - } - } - - request->send(404); - }); - server.onFileUpload([](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final){ - if(!index) - Serial.printf("UploadStart: %s\n", filename.c_str()); - Serial.printf("%s", (const char*)data); - if(final) - Serial.printf("UploadEnd: %s (%u)\n", filename.c_str(), index+len); - }); - server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total){ - if(!index) - Serial.printf("BodyStart: %u\n", total); - Serial.printf("%s", (const char*)data); - if(index + len == total) - Serial.printf("BodyEnd: %u\n", total); - }); - server.begin(); -} - -void loop(){ - ArduinoOTA.handle(); - ws.cleanupClients(); -} +// Defaulut is SPIFFS, FatFS: only on ESP32, also choose partition scheme w/ ffat. +// Comment 2 lines below or uncomment only one of them + +//#define USE_LittleFS +//#define USE_FatFS // Only ESP32 + +#include +#ifdef ESP32 + #include + #ifdef USE_LittleFS + #define MYFS LITTLEFS + #include "LITTLEFS.h" + #elif defined(USE_FatFS) + #define MYFS FFat + #include "FFat.h" + #else + #define MYFS SPIFFS + #include + #endif + #include + #include + #include +#elif defined(ESP8266) + #ifdef USE_LittleFS + #include + #define MYFS LittleFS + #include + #elif defined(USE_FatFS) + #error "FatFS only on ESP32 for now!" + #else + #define MYFS SPIFFS + #endif + #include + #include + #include +#endif +#include +#include + + +// SKETCH BEGIN +AsyncWebServer server(80); +AsyncWebSocket ws("/ws"); +AsyncEventSource events("/events"); + +void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len){ + if(type == WS_EVT_CONNECT){ + Serial.printf("ws[%s][%u] connect\n", server->url(), client->id()); + client->printf("Hello Client %u :)", client->id()); + client->ping(); + } else if(type == WS_EVT_DISCONNECT){ + Serial.printf("ws[%s][%u] disconnect\n", server->url(), client->id()); + } else if(type == WS_EVT_ERROR){ + Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data); + } else if(type == WS_EVT_PONG){ + Serial.printf("ws[%s][%u] pong[%u]: %s\n", server->url(), client->id(), len, (len)?(char*)data:""); + } else if(type == WS_EVT_DATA){ + AwsFrameInfo * info = (AwsFrameInfo*)arg; + String msg = ""; + if(info->final && info->index == 0 && info->len == len){ + //the whole message is in a single frame and we got all of it's data + Serial.printf("ws[%s][%u] %s-message[%llu]: ", server->url(), client->id(), (info->opcode == WS_TEXT)?"text":"binary", info->len); + + if(info->opcode == WS_TEXT){ + for(size_t i=0; i < info->len; i++) { + msg += (char) data[i]; + } + } else { + char buff[3]; + for(size_t i=0; i < info->len; i++) { + sprintf(buff, "%02x ", (uint8_t) data[i]); + msg += buff ; + } + } + Serial.printf("%s\n",msg.c_str()); + + if(info->opcode == WS_TEXT) + client->text("I got your text message"); + else + client->binary("I got your binary message"); + } else { + //message is comprised of multiple frames or the frame is split into multiple packets + if(info->index == 0){ + if(info->num == 0) + Serial.printf("ws[%s][%u] %s-message start\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary"); + Serial.printf("ws[%s][%u] frame[%u] start[%llu]\n", server->url(), client->id(), info->num, info->len); + } + + Serial.printf("ws[%s][%u] frame[%u] %s[%llu - %llu]: ", server->url(), client->id(), info->num, (info->message_opcode == WS_TEXT)?"text":"binary", info->index, info->index + len); + + if(info->opcode == WS_TEXT){ + for(size_t i=0; i < len; i++) { + msg += (char) data[i]; + } + } else { + char buff[3]; + for(size_t i=0; i < len; i++) { + sprintf(buff, "%02x ", (uint8_t) data[i]); + msg += buff ; + } + } + Serial.printf("%s\n",msg.c_str()); + + if((info->index + len) == info->len){ + Serial.printf("ws[%s][%u] frame[%u] end[%llu]\n", server->url(), client->id(), info->num, info->len); + if(info->final){ + Serial.printf("ws[%s][%u] %s-message end\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary"); + if(info->message_opcode == WS_TEXT) + client->text("I got your text message"); + else + client->binary("I got your binary message"); + } + } + } + } +} + +const char* ssid = "*****"; +const char* password = "*****"; +const char* hostName = "esp-async"; +const char* http_username = "admin"; +const char* http_password = "admin"; + +void setup(){ + Serial.begin(115200); + Serial.setDebugOutput(true); + WiFi.mode(WIFI_AP_STA); + WiFi.softAP(hostName); + WiFi.begin(ssid, password); + if (WiFi.waitForConnectResult() != WL_CONNECTED) { + Serial.printf("STA: Failed!\n"); + WiFi.disconnect(false); + delay(1000); + WiFi.begin(ssid, password); + } + + Serial.print(F("*CONNECTED* IP:")); + Serial.println(WiFi.localIP()); + + //Send OTA events to the browser + ArduinoOTA.onStart([]() { events.send("Update Start", "ota"); }); + ArduinoOTA.onEnd([]() { events.send("Update End", "ota"); }); + ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { + char p[32]; + sprintf(p, "Progress: %u%%\n", (progress/(total/100))); + events.send(p, "ota"); + }); + ArduinoOTA.onError([](ota_error_t error) { + if(error == OTA_AUTH_ERROR) events.send("Auth Failed", "ota"); + else if(error == OTA_BEGIN_ERROR) events.send("Begin Failed", "ota"); + else if(error == OTA_CONNECT_ERROR) events.send("Connect Failed", "ota"); + else if(error == OTA_RECEIVE_ERROR) events.send("Recieve Failed", "ota"); + else if(error == OTA_END_ERROR) events.send("End Failed", "ota"); + }); + ArduinoOTA.setHostname(hostName); + ArduinoOTA.begin(); + + MDNS.addService("http","tcp",80); + + MYFS.begin(); + + ws.onEvent(onWsEvent); + server.addHandler(&ws); + + events.onConnect([](AsyncEventSourceClient *client){ + client->send("hello!",NULL,millis(),1000); + }); + server.addHandler(&events); + +#ifdef ESP32 + server.addHandler(new SPIFFSEditor(MYFS, http_username,http_password)); +#elif defined(ESP8266) + server.addHandler(new SPIFFSEditor(http_username,http_password, MYFS)); +#endif + + server.on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){ + request->send(200, "text/plain", String(ESP.getFreeHeap())); + }); + + server.serveStatic("/", MYFS, "/").setDefaultFile("index.htm"); + + server.onNotFound([](AsyncWebServerRequest *request){ + Serial.printf("NOT_FOUND: "); + if(request->method() == HTTP_GET) + Serial.printf("GET"); + else if(request->method() == HTTP_POST) + Serial.printf("POST"); + else if(request->method() == HTTP_DELETE) + Serial.printf("DELETE"); + else if(request->method() == HTTP_PUT) + Serial.printf("PUT"); + else if(request->method() == HTTP_PATCH) + Serial.printf("PATCH"); + else if(request->method() == HTTP_HEAD) + Serial.printf("HEAD"); + else if(request->method() == HTTP_OPTIONS) + Serial.printf("OPTIONS"); + else + Serial.printf("UNKNOWN"); + Serial.printf(" http://%s%s\n", request->host().c_str(), request->url().c_str()); + + if(request->contentLength()){ + Serial.printf("_CONTENT_TYPE: %s\n", request->contentType().c_str()); + Serial.printf("_CONTENT_LENGTH: %u\n", request->contentLength()); + } + + int headers = request->headers(); + int i; + for(i=0;igetHeader(i); + Serial.printf("_HEADER[%s]: %s\n", h->name().c_str(), h->value().c_str()); + } + + int params = request->params(); + for(i=0;igetParam(i); + if(p->isFile()){ + Serial.printf("_FILE[%s]: %s, size: %u\n", p->name().c_str(), p->value().c_str(), p->size()); + } else if(p->isPost()){ + Serial.printf("_POST[%s]: %s\n", p->name().c_str(), p->value().c_str()); + } else { + Serial.printf("_GET[%s]: %s\n", p->name().c_str(), p->value().c_str()); + } + } + + request->send(404); + }); + server.onFileUpload([](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final){ + if(!index) + Serial.printf("UploadStart: %s\n", filename.c_str()); + Serial.printf("%s", (const char*)data); + if(final) + Serial.printf("UploadEnd: %s (%u)\n", filename.c_str(), index+len); + }); + server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total){ + if(!index) + Serial.printf("BodyStart: %u\n", total); + Serial.printf("%s", (const char*)data); + if(index + len == total) + Serial.printf("BodyEnd: %u\n", total); + }); + server.begin(); +} + +void loop(){ + ArduinoOTA.handle(); + ws.cleanupClients(); +} diff --git a/examples/ESP_AsyncFSBrowser/data/acefull.js.gz b/examples/ESP_AsyncFSBrowser/data/acefull.js.gz index f795265..e88a884 100644 Binary files a/examples/ESP_AsyncFSBrowser/data/acefull.js.gz and b/examples/ESP_AsyncFSBrowser/data/acefull.js.gz differ diff --git a/examples/ESP_AsyncFSBrowser/data/worker-css.js.gz b/examples/ESP_AsyncFSBrowser/data/worker-css.js.gz index 0ba451b..658f04a 100644 Binary files a/examples/ESP_AsyncFSBrowser/data/worker-css.js.gz and b/examples/ESP_AsyncFSBrowser/data/worker-css.js.gz differ diff --git a/examples/ESP_AsyncFSBrowser/data/worker-html.js.gz b/examples/ESP_AsyncFSBrowser/data/worker-html.js.gz index 4963128..1556f5a 100644 Binary files a/examples/ESP_AsyncFSBrowser/data/worker-html.js.gz and b/examples/ESP_AsyncFSBrowser/data/worker-html.js.gz differ diff --git a/examples/ESP_AsyncFSBrowser/data/worker-javascript.js.gz b/examples/ESP_AsyncFSBrowser/data/worker-javascript.js.gz index 9909a16..2b45889 100644 Binary files a/examples/ESP_AsyncFSBrowser/data/worker-javascript.js.gz and b/examples/ESP_AsyncFSBrowser/data/worker-javascript.js.gz differ diff --git a/examples/SmartSwitch/SmartSwitch.ino b/examples/SmartSwitch/SmartSwitch.ino index 19affa4..727026e 100644 --- a/examples/SmartSwitch/SmartSwitch.ino +++ b/examples/SmartSwitch/SmartSwitch.ino @@ -13,7 +13,12 @@ Multiple clients can be connected at same time, they see each other requests Use latest ESP core lib (from Github) */ +// Defaulut is SPIFFS, FatFS: only on ESP32 +// Comment 2 lines below or uncomment only one of them + #define USE_LittleFS +//#define USE_FatFS // select partition scheme w/ ffat! + #define USE_WFM // to use ESPAsyncWiFiManager //#define DEL_WFM // delete Wifi credentials stored @@ -42,10 +47,17 @@ Use latest ESP core lib (from Github) #ifdef ESP32 #include #ifdef USE_LittleFS - #define SPIFFS LITTLEFS - #include + #define HSTNM "ssw32-littlefs" + #define MYFS LITTLEFS + #include "LITTLEFS.h" + #elif defined(USE_FatFS) + #define HSTNM "ssw32-ffat" + #define MYFS FFat + #include "FFat.h" #else + #define MYFS SPIFFS #include + #define HSTNM "ssw32-spiffs" #endif #include #include @@ -53,8 +65,14 @@ Use latest ESP core lib (from Github) #elif defined(ESP8266) #ifdef USE_LittleFS #include - #define SPIFFS LittleFS + #define HSTNM "ssw8266-littlefs" + #define MYFS LittleFS #include + #elif defined(USE_FatFS) + #error "FatFS only on ESP32 for now!" + #else + #define HSTNM "ssw8266-spiffs" + #define MYFS SPIFFS #endif #include #include @@ -120,7 +138,7 @@ AsyncWebSocket ws("/ws"); const char* password = "MYROUTERPASSWD"; #endif -const char* hostName = "smartsw"; +const char* hostName = HSTNM; // RTC static timeval tv; @@ -532,7 +550,7 @@ void setup(){ Serial.printf("Temp set %+2.1f\n", ee.tempe); //FS - if (SPIFFS.begin()) { + if (MYFS.begin()) { Serial.print(F("FS mounted\n")); } else { Serial.print(F("FS mount failed\n")); @@ -551,19 +569,19 @@ void setup(){ #ifdef ESP32 #ifdef USE_AUTH_STAT - server.addHandler(new SPIFFSEditor(SPIFFS, http_username,http_password)); + server.addHandler(new SPIFFSEditor(MYFS, http_username,http_password)); #elif defined(USE_AUTH_COOKIE) - server.addHandler(new SPIFFSEditor(SPIFFS)).setFilter(myHandshake); + server.addHandler(new SPIFFSEditor(MYFS)).setFilter(myHandshake); #else - server.addHandler(new SPIFFSEditor(SPIFFS)); + server.addHandler(new SPIFFSEditor(MYFS)); #endif #elif defined(ESP8266) #ifdef USE_AUTH_STAT - server.addHandler(new SPIFFSEditor(http_username,http_password)); + server.addHandler(new SPIFFSEditor(http_username,http_password,MYFS)); #elif defined(USE_AUTH_COOKIE) - server.addHandler(new SPIFFSEditor()).setFilter(myHandshake); + server.addHandler(new SPIFFSEditor("","",MYFS)).setFilter(myHandshake); #else - server.addHandler(new SPIFFSEditor()); + server.addHandler(new SPIFFSEditor("","",MYFS)); #endif #endif @@ -668,13 +686,13 @@ void setup(){ // above paths need individual auth //////////////////////////////////////////////// #ifdef USE_AUTH_COOKIE - server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm").setFilter(myHandshake); - server.serveStatic("/", SPIFFS, "/login/").setDefaultFile("index.htm"); + server.serveStatic("/", MYFS, "/").setDefaultFile("index.htm").setFilter(myHandshake); + server.serveStatic("/", MYFS, "/login/").setDefaultFile("index.htm"); #else #ifdef USE_AUTH_STAT - server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm").setAuthentication(http_username,http_password); + server.serveStatic("/", MYFS, "/").setDefaultFile("index.htm").setAuthentication(http_username,http_password); #else - server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm"); + server.serveStatic("/", MYFS, "/").setDefaultFile("index.htm"); #endif #endif @@ -694,7 +712,7 @@ void setup(){ ArduinoOTA.setHostname(hostName); ArduinoOTA.onStart([]() { Serial.print(F("OTA Started ...\n")); - SPIFFS.end(); // Clean FS + MYFS.end(); // Clean FS ws.textAll("Now,OTA"); // for all clients ws.enable(false); ws.closeAll(); diff --git a/examples/SmartSwitch/data/acefull.js.gz b/examples/SmartSwitch/data/acefull.js.gz index f795265..e88a884 100644 Binary files a/examples/SmartSwitch/data/acefull.js.gz and b/examples/SmartSwitch/data/acefull.js.gz differ diff --git a/examples/SmartSwitch/data/worker-css.js.gz b/examples/SmartSwitch/data/worker-css.js.gz index 0ba451b..658f04a 100644 Binary files a/examples/SmartSwitch/data/worker-css.js.gz and b/examples/SmartSwitch/data/worker-css.js.gz differ diff --git a/examples/SmartSwitch/data/worker-html.js.gz b/examples/SmartSwitch/data/worker-html.js.gz index 4963128..1556f5a 100644 Binary files a/examples/SmartSwitch/data/worker-html.js.gz and b/examples/SmartSwitch/data/worker-html.js.gz differ diff --git a/examples/SmartSwitch/data/worker-javascript.js.gz b/examples/SmartSwitch/data/worker-javascript.js.gz index 9909a16..2b45889 100644 Binary files a/examples/SmartSwitch/data/worker-javascript.js.gz and b/examples/SmartSwitch/data/worker-javascript.js.gz differ diff --git a/src/edit.htm.gz.h b/src/edit.htm.gz.h index 0f937aa..9f10114 100644 --- a/src/edit.htm.gz.h +++ b/src/edit.htm.gz.h @@ -2,7 +2,7 @@ //File: edit.htm.gz, Size: 4503 #define edit_htm_gz_len 4503 const uint8_t edit_htm_gz[] PROGMEM = { -0x1F,0x8B,0x08,0x08,0x0F,0x7A,0xFF,0x5E,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5, +0x1F,0x8B,0x08,0x08,0x1C,0xAD,0x07,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5, 0x1A,0x0B,0x5B,0xDB,0x36,0xF0,0xAF,0x18,0x6F,0x63,0xF6,0xE2,0x38,0x0E,0x50,0xD6,0x3A,0x18,0x16,0x1E, 0xEB,0xBB,0x50,0x12,0xDA,0xD1,0x8E,0xED,0x53,0x6C,0x25,0x56,0xB1,0x25,0xCF,0x96,0x09,0x34,0xCD,0x7F, 0xDF,0x49,0xF2,0x93,0x84,0xEE,0xF1,0x6D,0xA5,0x60,0x49,0xA7,0x3B,0xDD,0x9D,0xEE,0x25,0xD9,0x7B,0x1B,