This commit is contained in:
zandoli 2026-01-30 16:04:43 +01:00
parent b483b46b40
commit 07ccf3acc0
5 changed files with 17 additions and 19 deletions

View File

@ -1,7 +1,6 @@
#include "CrossPointWebServer.h"
#include <ArduinoJson.h>
#include "util/BookCacheManager.h"
#include <Epub.h>
#include <FsHelpers.h>
#include <SDCardManager.h>
@ -12,6 +11,7 @@
#include "html/FilesPageHtml.generated.h"
#include "html/HomePageHtml.generated.h"
#include "util/BookCacheManager.h"
#include "util/StringUtils.h"
namespace {
@ -875,8 +875,6 @@ void CrossPointWebServer::handleRename() const {
}
}
// WebSocket callback trampoline
void CrossPointWebServer::wsEventCallback(uint8_t num, WStype_t type, uint8_t* payload, size_t length) {
if (wsInstance) {

View File

@ -80,5 +80,4 @@ class CrossPointWebServer {
void handleDelete() const;
void handleMove() const;
void handleRename() const;
};

View File

@ -1,8 +1,10 @@
#include "BookCacheManager.h"
#include "StringUtils.h"
#include <HardwareSerial.h>
#include "../RecentBooksStore.h"
#include "../CrossPointState.h"
#include "../RecentBooksStore.h"
#include "StringUtils.h"
bool BookCacheManager::migrateCache(const String& oldPath, const String& newPath) {
if (oldPath == newPath) return true;
@ -52,7 +54,7 @@ bool BookCacheManager::migrateCache(const String& oldPath, const String& newPath
// It's a file. check if it's a supported book type
if (!isSupportedFile(oldPath)) {
return true; // Not a book, nothing to migrate
return true; // Not a book, nothing to migrate
}
String oldCache = getCachePath(oldPath);
@ -78,7 +80,7 @@ bool BookCacheManager::migrateCache(const String& oldPath, const String& newPath
}
}
return true; // No old cache to migrate
return true; // No old cache to migrate
}
String BookCacheManager::getCachePath(const String& path) {
@ -89,15 +91,13 @@ String BookCacheManager::getCachePath(const String& path) {
}
bool BookCacheManager::isSupportedFile(const String& path) {
return StringUtils::checkFileExtension(path, ".epub") ||
StringUtils::checkFileExtension(path, ".txt") ||
StringUtils::checkFileExtension(path, ".xtc") ||
StringUtils::checkFileExtension(path, ".xtg") ||
return StringUtils::checkFileExtension(path, ".epub") || StringUtils::checkFileExtension(path, ".txt") ||
StringUtils::checkFileExtension(path, ".xtc") || StringUtils::checkFileExtension(path, ".xtg") ||
StringUtils::checkFileExtension(path, ".xth");
}
String BookCacheManager::getCachePrefix(const String& path) {
if (StringUtils::checkFileExtension(path, ".epub")) return "epub";
if (StringUtils::checkFileExtension(path, ".txt")) return "txt";
return "xtc"; // .xtc, .xtg, .xth
return "xtc"; // .xtc, .xtg, .xth
}

View File

@ -2,6 +2,7 @@
#include <SDCardManager.h>
#include <WString.h>
#include <string>
class BookCacheManager {