mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-23 14:53:07 +05:00
refactor: remove ESP8266 support and legacy flash wrappers
This commit is contained in:
1 parent
959a15c11f
commit
b72bccb3d7
24 files changed
+2027
-2415
No files matched your search
@@ -28,11 +28,9 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
bool canHandle(WebServer &server, HTTPMethod method, const String &uri) override {
|
||||
return this->canHandle(method, uri);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool canHandle(HTTPMethod method, const String& uri) override {
|
||||
return method == HTTP_GET && uri.equals(this->uri) && (!this->canHandleCallback || this->canHandleCallback(method, uri));
|
||||
@@ -54,17 +52,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->eTag.isEmpty() && server.header(F("If-None-Match")).equals(this->eTag.c_str())) {
|
||||
if (!this->eTag.isEmpty() && server.header("If-None-Match").equals(this->eTag.c_str())) {
|
||||
server.send(304);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->path.endsWith(FPSTR(mimeTable[gz].endsWith)) && !this->fs->exists(path)) {
|
||||
String pathWithGz = this->path + FPSTR(mimeTable[gz].endsWith);
|
||||
if (!this->path.endsWith(mimeTable[gz].endsWith) && !this->fs->exists(path)) {
|
||||
String pathWithGz = this->path + mimeTable[gz].endsWith;
|
||||
|
||||
if (this->fs->exists(pathWithGz)) {
|
||||
this->path += FPSTR(mimeTable[gz].endsWith);
|
||||
this->path += mimeTable[gz].endsWith;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,18 +76,14 @@ public:
|
||||
}
|
||||
|
||||
if (this->cacheHeader != nullptr) {
|
||||
server.sendHeader(F("Cache-Control"), this->cacheHeader);
|
||||
server.sendHeader("Cache-Control", this->cacheHeader);
|
||||
}
|
||||
|
||||
if (server._eTagEnabled && !this->eTag.isEmpty()) {
|
||||
server.sendHeader(F("ETag"), this->eTag);
|
||||
server.sendHeader("ETag", this->eTag);
|
||||
}
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
server.streamFile(file, F("text/html"), method);
|
||||
#else
|
||||
server.streamFile(file, F("text/html"), 200);
|
||||
#endif
|
||||
server.streamFile(file, "text/html", 200);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ public:
|
||||
result->status = UpgradeStatus::ERROR_ON_START;
|
||||
result->error = Update.errorString();
|
||||
|
||||
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on start: %s", fileName.c_str(), result->error.c_str());
|
||||
Log.serrorln(L_PORTAL_OTA, "File '%s', on start: %s", fileName.c_str(), result->error.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s', started", fileName.c_str());
|
||||
Log.sinfoln(L_PORTAL_OTA, "File '%s', started", fileName.c_str());
|
||||
}
|
||||
|
||||
if (dataLength) {
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
result->error = Update.errorString();
|
||||
|
||||
Log.serrorln(
|
||||
FPSTR(L_PORTAL_OTA), "File '%s', on write %d bytes, %d of %d bytes",
|
||||
L_PORTAL_OTA, "File '%s', on write %d bytes, %d of %d bytes",
|
||||
fileName.c_str(),
|
||||
dataLength,
|
||||
result->progress + dataLength,
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
result->progress += dataLength;
|
||||
Log.sinfoln(
|
||||
FPSTR(L_PORTAL_OTA), "File '%s', write %d bytes, %d of %d bytes",
|
||||
L_PORTAL_OTA, "File '%s', write %d bytes, %d of %d bytes",
|
||||
fileName.c_str(),
|
||||
dataLength,
|
||||
result->progress,
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
result->status = UpgradeStatus::SIZE_MISMATCH;
|
||||
|
||||
Log.serrorln(
|
||||
FPSTR(L_PORTAL_OTA), "File '%s', size mismatch: %d of %d bytes",
|
||||
L_PORTAL_OTA, "File '%s', size mismatch: %d of %d bytes",
|
||||
fileName.c_str(),
|
||||
result->progress,
|
||||
result->size
|
||||
@@ -185,12 +185,12 @@ public:
|
||||
result->status = UpgradeStatus::ERROR_ON_FINISH;
|
||||
result->error = Update.errorString();
|
||||
|
||||
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on finish: %s", fileName.c_str(), result->error);
|
||||
Log.serrorln(L_PORTAL_OTA, "File '%s', on finish: %s", fileName.c_str(), result->error.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
result->status = UpgradeStatus::SUCCESS;
|
||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s': finish", fileName.c_str());
|
||||
Log.sinfoln(L_PORTAL_OTA, "File '%s': finish", fileName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user