disable spiffs

This commit is contained in:
technyon
2023-02-07 18:12:42 +01:00
parent 2a6a1355b2
commit 7848dde274
4 changed files with 9 additions and 8 deletions

View File

@@ -120,15 +120,9 @@ target_link_arduino_libraries(${PROJECT_NAME}
WiFi WiFi
WiFiClientSecure WiFiClientSecure
Update Update
# WebServer
DNSServer DNSServer
Preferences Preferences
SPIFFS
SPI SPI
# Ethernet
# esp32
# Wire
# FS
) )
target_link_arduino_libraries(DNSServer PUBLIC WiFi) target_link_arduino_libraries(DNSServer PUBLIC WiFi)

View File

@@ -26,7 +26,9 @@
#include <libb64/cencode.h> #include <libb64/cencode.h>
#include "WiFiClient.h" #include "WiFiClient.h"
#include "WebServer.h" #include "WebServer.h"
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
#include "FS.h" #include "FS.h"
#endif
#include "detail/RequestHandlersImpl.h" #include "detail/RequestHandlersImpl.h"
#include "mbedtls/md5.h" #include "mbedtls/md5.h"
@@ -258,9 +260,11 @@ void WebServer::_addRequestHandler(RequestHandler* handler) {
} }
} }
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
void WebServer::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) { void WebServer::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) {
_addRequestHandler(new StaticRequestHandler(fs, path, uri, cache_header)); _addRequestHandler(new StaticRequestHandler(fs, path, uri, cache_header));
} }
#endif
void WebServer::handleClient() { void WebServer::handleClient() {
if (_currentStatus == HC_NONE) { if (_currentStatus == HC_NONE) {

View File

@@ -90,7 +90,9 @@ public:
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn); void on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn);
void addHandler(RequestHandler* handler); void addHandler(RequestHandler* handler);
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL ); void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL );
#endif
void onNotFound(THandlerFunction fn); //called when handler is not assigned void onNotFound(THandlerFunction fn); //called when handler is not assigned
void onFileUpload(THandlerFunction fn); //handle file uploads void onFileUpload(THandlerFunction fn); //handle file uploads

View File

@@ -60,6 +60,7 @@ protected:
HTTPMethod _method; HTTPMethod _method;
}; };
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
class StaticRequestHandler : public RequestHandler { class StaticRequestHandler : public RequestHandler {
public: public:
StaticRequestHandler(FS& fs, const char* path, const char* uri, const char* cache_header) StaticRequestHandler(FS& fs, const char* path, const char* uri, const char* cache_header)
@@ -146,6 +147,6 @@ protected:
bool _isFile; bool _isFile;
size_t _baseUriLength; size_t _baseUriLength;
}; };
#endif
#endif //REQUESTHANDLERSIMPL_H #endif //REQUESTHANDLERSIMPL_H