In SPIFFSEditor.h Prevented a warning that SPIFFS has been deprecated on esp32

In WebHandlers.cpp  A difference between SPIFFS and LITTLEFS of opendir() response in file.open() of FS vfs_api.cpp has been resolved.
This commit is contained in:
lorol
2020-08-19 14:22:06 -04:00
parent c61f2d8d02
commit d803e12980
12 changed files with 20 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG" export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
elif [ -z "$GITHUB_WORKSPACE" ]; then elif [ -z "$GITHUB_WORKSPACE" ]; then
export GITHUB_WORKSPACE="$PWD" export GITHUB_WORKSPACE="$PWD"
export GITHUB_REPOSITORY="me-no-dev/ESPAsyncWebServer" export GITHUB_REPOSITORY="lorol/ESPAsyncWebServer"
fi fi
TARGET_PLATFORM="$1" TARGET_PLATFORM="$1"
@@ -34,8 +34,12 @@ if [ "$BUILD_PIO" -eq 0 ]; then
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer" cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer"
echo "Installing ArduinoJson ..." echo "Installing ArduinoJson ..."
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1 git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
echo "Installing DHT sensor library ..."
git clone https://github.com/adafruit/DHT-sensor-library "$ARDUINO_USR_PATH/libraries/DHT-sensor-library" > /dev/null 2>&1
if [[ "$TARGET_PLATFORM" == "esp32" ]]; then if [[ "$TARGET_PLATFORM" == "esp32" ]]; then
echo "Installing LITTLEFS for ESP32 ..."
git clone https://github.com/lorol/LITTLEFS "$ARDUINO_USR_PATH/libraries/LITTLEFS" > /dev/null 2>&1
echo "Installing AsyncTCP ..." echo "Installing AsyncTCP ..."
git clone https://github.com/me-no-dev/AsyncTCP "$ARDUINO_USR_PATH/libraries/AsyncTCP" > /dev/null 2>&1 git clone https://github.com/me-no-dev/AsyncTCP "$ARDUINO_USR_PATH/libraries/AsyncTCP" > /dev/null 2>&1
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app" FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"

View File

@@ -13,7 +13,8 @@ class SPIFFSEditor: public AsyncWebHandler {
#ifdef ESP32 #ifdef ESP32
SPIFFSEditor(const fs::FS& fs, const String& username=String(), const String& password=String()); SPIFFSEditor(const fs::FS& fs, const String& username=String(), const String& password=String());
#else #else
SPIFFSEditor(const String& username=String(), const String& password=String(), const fs::FS& fs=SPIFFS); //SPIFFSEditor(const String& username=String(), const String& password=String(), const fs::FS& fs=SPIFFS);
SPIFFSEditor(const String& username, const String& password, const fs::FS& fs); // do not show warning that SPIFFS has been deprecated
#endif #endif
virtual bool canHandle(AsyncWebServerRequest *request) override final; virtual bool canHandle(AsyncWebServerRequest *request) override final;
virtual void handleRequest(AsyncWebServerRequest *request) override final; virtual void handleRequest(AsyncWebServerRequest *request) override final;

View File

@@ -146,20 +146,28 @@ bool AsyncStaticWebHandler::_fileExists(AsyncWebServerRequest *request, const St
String gzip = path + F(".gz"); String gzip = path + F(".gz");
if (_gzipFirst) { if (_gzipFirst) {
if (_fs.exists(gzip)) {
request->_tempFile = _fs.open(gzip, fs::FileOpenMode::read); request->_tempFile = _fs.open(gzip, fs::FileOpenMode::read);
gzipFound = FILE_IS_REAL(request->_tempFile); gzipFound = FILE_IS_REAL(request->_tempFile);
}
if (!gzipFound){ if (!gzipFound){
if (_fs.exists(path)) {
request->_tempFile = _fs.open(path, fs::FileOpenMode::read); request->_tempFile = _fs.open(path, fs::FileOpenMode::read);
fileFound = FILE_IS_REAL(request->_tempFile); fileFound = FILE_IS_REAL(request->_tempFile);
} }
}
} else { } else {
if (_fs.exists(path)) {
request->_tempFile = _fs.open(path, fs::FileOpenMode::read); request->_tempFile = _fs.open(path, fs::FileOpenMode::read);
fileFound = FILE_IS_REAL(request->_tempFile); fileFound = FILE_IS_REAL(request->_tempFile);
}
if (!fileFound){ if (!fileFound){
if (_fs.exists(gzip)) {
request->_tempFile = _fs.open(gzip, fs::FileOpenMode::read); request->_tempFile = _fs.open(gzip, fs::FileOpenMode::read);
gzipFound = FILE_IS_REAL(request->_tempFile); gzipFound = FILE_IS_REAL(request->_tempFile);
} }
} }
}
bool found = fileFound || gzipFound; bool found = fileFound || gzipFound;

View File

@@ -2,7 +2,7 @@
//File: edit.htm.gz, Size: 4503 //File: edit.htm.gz, Size: 4503
#define edit_htm_gz_len 4503 #define edit_htm_gz_len 4503
const uint8_t edit_htm_gz[] PROGMEM = { const uint8_t edit_htm_gz[] PROGMEM = {
0x1F,0x8B,0x08,0x08,0x9B,0xC8,0x22,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5, 0x1F,0x8B,0x08,0x08,0x66,0x6B,0x3D,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, 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, 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, 0xDF,0x49,0xF2,0x93,0x84,0xEE,0xF1,0x6D,0xA5,0x60,0x49,0xA7,0x3B,0xDD,0x9D,0xEE,0x25,0xD9,0x7B,0x1B,