#pragma once #include #include // Structure to hold file information struct FileInfo { String name; size_t size; bool isEpub; bool isDirectory; }; class CrossPointWebServer { public: CrossPointWebServer(); ~CrossPointWebServer(); // Start the web server (call after WiFi is connected) void begin(); // Stop the web server void stop(); // Call this periodically to handle client requests void handleClient() const; // Check if server is running bool isRunning() const { return running; } // Get the port number uint16_t getPort() const { return port; } private: std::unique_ptr server = nullptr; bool running = false; uint16_t port = 80; // File scanning std::vector scanFiles(const char* path = "/") const; String formatFileSize(size_t bytes) const; bool isEpubFile(const String& filename) const; // Request handlers void handleRoot() const; void handleNotFound() const; void handleStatus() const; void handleFileList() const; void handleUpload() const; void handleUploadPost() const; void handleCreateFolder() const; void handleDelete() const; };