From 397abe1ef0aff4fb2cf2187893b37184d1dca5e8 Mon Sep 17 00:00:00 2001 From: cottongin Date: Tue, 27 Jan 2026 08:44:54 -0500 Subject: [PATCH] checkpoint 2 - post PR merge - debug ghosting --- src/activities/reader/TxtReaderActivity.cpp | 2 +- src/network/CrossPointWebServer.cpp | 63 --------------------- src/network/CrossPointWebServer.h | 1 - 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/activities/reader/TxtReaderActivity.cpp b/src/activities/reader/TxtReaderActivity.cpp index 62e8665..cbb69d6 100644 --- a/src/activities/reader/TxtReaderActivity.cpp +++ b/src/activities/reader/TxtReaderActivity.cpp @@ -109,7 +109,7 @@ void TxtReaderActivity::onEnter() { APP_STATE.openBookTitle = txt->getTitle(); APP_STATE.openBookAuthor.clear(); // TXT files don't have author metadata APP_STATE.saveToFile(); - RECENT_BOOKS.addBook(txt->getPath()); + RECENT_BOOKS.addBook(txt->getPath(), txt->getTitle(), ""); // TXT files have no author metadata // Trigger first update updateRequired = true; diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index 7ec745f..ca53640 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -489,69 +489,6 @@ void CrossPointWebServer::handleFileListData() const { Serial.printf("[%lu] [WEB] Served file listing page for path: %s\n", millis(), currentPath.c_str()); } -void CrossPointWebServer::handleDownload() const { - if (!server->hasArg("path")) { - server->send(400, "text/plain", "Missing path"); - return; - } - - String itemPath = server->arg("path"); - if (itemPath.isEmpty() || itemPath == "/") { - server->send(400, "text/plain", "Invalid path"); - return; - } - if (!itemPath.startsWith("/")) { - itemPath = "/" + itemPath; - } - - const String itemName = itemPath.substring(itemPath.lastIndexOf('/') + 1); - if (itemName.startsWith(".")) { - server->send(403, "text/plain", "Cannot access system files"); - return; - } - for (size_t i = 0; i < HIDDEN_ITEMS_COUNT; i++) { - if (itemName.equals(HIDDEN_ITEMS[i])) { - server->send(403, "text/plain", "Cannot access protected items"); - return; - } - } - - if (!SdMan.exists(itemPath.c_str())) { - server->send(404, "text/plain", "Item not found"); - return; - } - - FsFile file = SdMan.open(itemPath.c_str()); - if (!file) { - server->send(500, "text/plain", "Failed to open file"); - return; - } - if (file.isDirectory()) { - file.close(); - server->send(400, "text/plain", "Path is a directory"); - return; - } - - String contentType = "application/octet-stream"; - if (isEpubFile(itemPath)) { - contentType = "application/epub+zip"; - } - - char nameBuf[128] = {0}; - String filename = "download"; - if (file.getName(nameBuf, sizeof(nameBuf))) { - filename = nameBuf; - } - - server->setContentLength(file.size()); - server->sendHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); - server->send(200, contentType.c_str(), ""); - - WiFiClient client = server->client(); - client.write(file); - file.close(); -} - // Static variables for upload handling static FsFile uploadFile; static String uploadFileName; diff --git a/src/network/CrossPointWebServer.h b/src/network/CrossPointWebServer.h index 30028b5..050f7eb 100644 --- a/src/network/CrossPointWebServer.h +++ b/src/network/CrossPointWebServer.h @@ -99,7 +99,6 @@ class CrossPointWebServer { void handleArchive() const; void handleUnarchive() const; void handleArchivedList() const; - void handleDownload() const; void handleRename() const; void handleCopy() const; void handleMove() const;