mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
clang format
This commit is contained in:
parent
e9e6982eea
commit
05da79f6ad
@ -2,6 +2,7 @@
|
||||
|
||||
#include <SD.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "config.h"
|
||||
@ -11,26 +12,35 @@ CrossPointWebServer crossPointWebServer;
|
||||
|
||||
// Folders/files to hide from the web interface file browser
|
||||
// Note: Items starting with "." are automatically hidden
|
||||
static const char* HIDDEN_ITEMS[] = {
|
||||
"System Volume Information",
|
||||
"XTCache"
|
||||
};
|
||||
static const char* HIDDEN_ITEMS[] = {"System Volume Information", "XTCache"};
|
||||
static const size_t HIDDEN_ITEMS_COUNT = sizeof(HIDDEN_ITEMS) / sizeof(HIDDEN_ITEMS[0]);
|
||||
|
||||
// Helper function to escape HTML special characters to prevent XSS
|
||||
static String escapeHtml(const String& input) {
|
||||
String output;
|
||||
output.reserve(input.length() * 1.1); // Pre-allocate with some extra space
|
||||
|
||||
|
||||
for (size_t i = 0; i < input.length(); i++) {
|
||||
char c = input.charAt(i);
|
||||
switch (c) {
|
||||
case '&': output += "&"; break;
|
||||
case '<': output += "<"; break;
|
||||
case '>': output += ">"; break;
|
||||
case '"': output += """; break;
|
||||
case '\'': output += "'"; break;
|
||||
default: output += c; break;
|
||||
case '&':
|
||||
output += "&";
|
||||
break;
|
||||
case '<':
|
||||
output += "<";
|
||||
break;
|
||||
case '>':
|
||||
output += ">";
|
||||
break;
|
||||
case '"':
|
||||
output += """;
|
||||
break;
|
||||
case '\'':
|
||||
output += "'";
|
||||
break;
|
||||
default:
|
||||
output += c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
@ -849,9 +859,7 @@ static const char* FILES_PAGE_FOOTER = R"rawliteral(
|
||||
|
||||
CrossPointWebServer::CrossPointWebServer() {}
|
||||
|
||||
CrossPointWebServer::~CrossPointWebServer() {
|
||||
stop();
|
||||
}
|
||||
CrossPointWebServer::~CrossPointWebServer() { stop(); }
|
||||
|
||||
void CrossPointWebServer::begin() {
|
||||
if (running) {
|
||||
@ -877,16 +885,16 @@ void CrossPointWebServer::begin() {
|
||||
server->on("/", HTTP_GET, [this]() { handleRoot(); });
|
||||
server->on("/status", HTTP_GET, [this]() { handleStatus(); });
|
||||
server->on("/files", HTTP_GET, [this]() { handleFileList(); });
|
||||
|
||||
|
||||
// Upload endpoint with special handling for multipart form data
|
||||
server->on("/upload", HTTP_POST, [this]() { handleUploadPost(); }, [this]() { handleUpload(); });
|
||||
|
||||
|
||||
// Create folder endpoint
|
||||
server->on("/mkdir", HTTP_POST, [this]() { handleCreateFolder(); });
|
||||
|
||||
|
||||
// Delete file/folder endpoint
|
||||
server->on("/delete", HTTP_POST, [this]() { handleDelete(); });
|
||||
|
||||
|
||||
server->onNotFound([this]() { handleNotFound(); });
|
||||
|
||||
server->begin();
|
||||
@ -953,13 +961,13 @@ void CrossPointWebServer::handleStatus() {
|
||||
|
||||
std::vector<FileInfo> CrossPointWebServer::scanFiles(const char* path) {
|
||||
std::vector<FileInfo> files;
|
||||
|
||||
|
||||
File root = SD.open(path);
|
||||
if (!root) {
|
||||
Serial.printf("[%lu] [WEB] Failed to open directory: %s\n", millis(), path);
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
if (!root.isDirectory()) {
|
||||
Serial.printf("[%lu] [WEB] Not a directory: %s\n", millis(), path);
|
||||
root.close();
|
||||
@ -967,14 +975,14 @@ std::vector<FileInfo> CrossPointWebServer::scanFiles(const char* path) {
|
||||
}
|
||||
|
||||
Serial.printf("[%lu] [WEB] Scanning files in: %s\n", millis(), path);
|
||||
|
||||
|
||||
File file = root.openNextFile();
|
||||
while (file) {
|
||||
String fileName = String(file.name());
|
||||
|
||||
|
||||
// Skip hidden items (starting with ".")
|
||||
bool shouldHide = fileName.startsWith(".");
|
||||
|
||||
|
||||
// Check against explicitly hidden items list
|
||||
if (!shouldHide) {
|
||||
for (size_t i = 0; i < HIDDEN_ITEMS_COUNT; i++) {
|
||||
@ -984,12 +992,12 @@ std::vector<FileInfo> CrossPointWebServer::scanFiles(const char* path) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!shouldHide) {
|
||||
FileInfo info;
|
||||
info.name = fileName;
|
||||
info.isDirectory = file.isDirectory();
|
||||
|
||||
|
||||
if (info.isDirectory) {
|
||||
info.size = 0;
|
||||
info.isEpub = false;
|
||||
@ -997,15 +1005,15 @@ std::vector<FileInfo> CrossPointWebServer::scanFiles(const char* path) {
|
||||
info.size = file.size();
|
||||
info.isEpub = isEpubFile(info.name);
|
||||
}
|
||||
|
||||
|
||||
files.push_back(info);
|
||||
}
|
||||
|
||||
|
||||
file.close();
|
||||
file = root.openNextFile();
|
||||
}
|
||||
root.close();
|
||||
|
||||
|
||||
Serial.printf("[%lu] [WEB] Found %d items (files and folders)\n", millis(), files.size());
|
||||
return files;
|
||||
}
|
||||
@ -1028,7 +1036,7 @@ bool CrossPointWebServer::isEpubFile(const String& filename) {
|
||||
|
||||
void CrossPointWebServer::handleFileList() {
|
||||
String html = FILES_PAGE_HEADER;
|
||||
|
||||
|
||||
// Get current path from query string (default to root)
|
||||
String currentPath = "/";
|
||||
if (server->hasArg("path")) {
|
||||
@ -1042,20 +1050,20 @@ void CrossPointWebServer::handleFileList() {
|
||||
currentPath = currentPath.substring(0, currentPath.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get message from query string if present
|
||||
if (server->hasArg("msg")) {
|
||||
String msg = escapeHtml(server->arg("msg"));
|
||||
String msgType = server->hasArg("type") ? escapeHtml(server->arg("type")) : "success";
|
||||
html += "<div class=\"message " + msgType + "\">" + msg + "</div>";
|
||||
}
|
||||
|
||||
|
||||
// Hidden input to store current path for JavaScript
|
||||
html += "<input type=\"hidden\" id=\"currentPath\" value=\"" + currentPath + "\">";
|
||||
|
||||
|
||||
// Scan files in current path first (we need counts for the header)
|
||||
std::vector<FileInfo> files = scanFiles(currentPath.c_str());
|
||||
|
||||
|
||||
// Count items
|
||||
int epubCount = 0;
|
||||
int folderCount = 0;
|
||||
@ -1068,25 +1076,25 @@ void CrossPointWebServer::handleFileList() {
|
||||
totalSize += file.size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Page header with inline breadcrumb and +Add dropdown
|
||||
html += "<div class=\"page-header\">";
|
||||
html += "<div class=\"page-header-left\">";
|
||||
html += "<h1>📁 File Manager</h1>";
|
||||
|
||||
|
||||
// Inline breadcrumb
|
||||
html += "<div class=\"breadcrumb-inline\">";
|
||||
html += "<span class=\"sep\">/</span>";
|
||||
|
||||
|
||||
if (currentPath == "/") {
|
||||
html += "<span class=\"current\">🏠</span>";
|
||||
} else {
|
||||
html += "<a href=\"/files\">🏠</a>";
|
||||
String pathParts = currentPath.substring(1); // Remove leading /
|
||||
String pathParts = currentPath.substring(1); // Remove leading /
|
||||
String buildPath = "";
|
||||
int start = 0;
|
||||
int end = pathParts.indexOf('/');
|
||||
|
||||
|
||||
while (start < (int)pathParts.length()) {
|
||||
String part;
|
||||
if (end == -1) {
|
||||
@ -1105,7 +1113,7 @@ void CrossPointWebServer::handleFileList() {
|
||||
}
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
|
||||
|
||||
// +Add dropdown button
|
||||
html += "<div class=\"add-dropdown\" id=\"addDropdown\">";
|
||||
html += "<button class=\"add-btn\" onclick=\"toggleDropdown()\">";
|
||||
@ -1121,12 +1129,12 @@ void CrossPointWebServer::handleFileList() {
|
||||
html += "</button>";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
|
||||
html += "</div>"; // end page-header
|
||||
|
||||
|
||||
html += "</div>"; // end page-header
|
||||
|
||||
// Contents card with inline summary
|
||||
html += "<div class=\"card\">";
|
||||
|
||||
|
||||
// Contents header with inline stats
|
||||
html += "<div class=\"contents-header\">";
|
||||
html += "<h2 class=\"contents-title\">Contents</h2>";
|
||||
@ -1136,13 +1144,13 @@ void CrossPointWebServer::handleFileList() {
|
||||
html += formatFileSize(totalSize);
|
||||
html += "</span>";
|
||||
html += "</div>";
|
||||
|
||||
|
||||
if (files.empty()) {
|
||||
html += "<div class=\"no-files\">This folder is empty</div>";
|
||||
} else {
|
||||
html += "<table class=\"file-table\">";
|
||||
html += "<tr><th>Name</th><th>Type</th><th>Size</th><th class=\"actions-col\">Actions</th></tr>";
|
||||
|
||||
|
||||
// Sort files: folders first, then epub files, then other files, alphabetically within each group
|
||||
std::sort(files.begin(), files.end(), [](const FileInfo& a, const FileInfo& b) {
|
||||
// Folders come first
|
||||
@ -1154,29 +1162,30 @@ void CrossPointWebServer::handleFileList() {
|
||||
// Then alphabetically
|
||||
return a.name < b.name;
|
||||
});
|
||||
|
||||
|
||||
for (const auto& file : files) {
|
||||
String rowClass;
|
||||
String icon;
|
||||
String badge;
|
||||
String typeStr;
|
||||
String sizeStr;
|
||||
|
||||
|
||||
if (file.isDirectory) {
|
||||
rowClass = "folder-row";
|
||||
icon = "📁";
|
||||
badge = "<span class=\"folder-badge\">FOLDER</span>";
|
||||
typeStr = "Folder";
|
||||
sizeStr = "-";
|
||||
|
||||
|
||||
// Build the path to this folder
|
||||
String folderPath = currentPath;
|
||||
if (!folderPath.endsWith("/")) folderPath += "/";
|
||||
folderPath += file.name;
|
||||
|
||||
|
||||
html += "<tr class=\"" + rowClass + "\">";
|
||||
html += "<td><span class=\"file-icon\">" + icon + "</span>";
|
||||
html += "<a href=\"/files?path=" + folderPath + "\" class=\"folder-link\">" + escapeHtml(file.name) + "</a>" + badge + "</td>";
|
||||
html += "<a href=\"/files?path=" + folderPath + "\" class=\"folder-link\">" + escapeHtml(file.name) + "</a>" +
|
||||
badge + "</td>";
|
||||
html += "<td>" + typeStr + "</td>";
|
||||
html += "<td>" + sizeStr + "</td>";
|
||||
// Escape quotes for JavaScript string
|
||||
@ -1184,7 +1193,8 @@ void CrossPointWebServer::handleFileList() {
|
||||
escapedName.replace("'", "\\'");
|
||||
String escapedPath = folderPath;
|
||||
escapedPath.replace("'", "\\'");
|
||||
html += "<td class=\"actions-col\"><button class=\"delete-btn\" onclick=\"openDeleteModal('" + escapedName + "', '" + escapedPath + "', true)\" title=\"Delete folder\">🗑️</button></td>";
|
||||
html += "<td class=\"actions-col\"><button class=\"delete-btn\" onclick=\"openDeleteModal('" + escapedName +
|
||||
"', '" + escapedPath + "', true)\" title=\"Delete folder\">🗑️</button></td>";
|
||||
html += "</tr>";
|
||||
} else {
|
||||
rowClass = file.isEpub ? "epub-file" : "";
|
||||
@ -1194,12 +1204,12 @@ void CrossPointWebServer::handleFileList() {
|
||||
ext.toUpperCase();
|
||||
typeStr = ext;
|
||||
sizeStr = formatFileSize(file.size);
|
||||
|
||||
|
||||
// Build file path for delete
|
||||
String filePath = currentPath;
|
||||
if (!filePath.endsWith("/")) filePath += "/";
|
||||
filePath += file.name;
|
||||
|
||||
|
||||
html += "<tr class=\"" + rowClass + "\">";
|
||||
html += "<td><span class=\"file-icon\">" + icon + "</span>" + escapeHtml(file.name) + badge + "</td>";
|
||||
html += "<td>" + typeStr + "</td>";
|
||||
@ -1209,18 +1219,19 @@ void CrossPointWebServer::handleFileList() {
|
||||
escapedName.replace("'", "\\'");
|
||||
String escapedPath = filePath;
|
||||
escapedPath.replace("'", "\\'");
|
||||
html += "<td class=\"actions-col\"><button class=\"delete-btn\" onclick=\"openDeleteModal('" + escapedName + "', '" + escapedPath + "', false)\" title=\"Delete file\">🗑️</button></td>";
|
||||
html += "<td class=\"actions-col\"><button class=\"delete-btn\" onclick=\"openDeleteModal('" + escapedName +
|
||||
"', '" + escapedPath + "', false)\" title=\"Delete file\">🗑️</button></td>";
|
||||
html += "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
html += "</table>";
|
||||
}
|
||||
|
||||
|
||||
html += "</div>";
|
||||
|
||||
|
||||
html += FILES_PAGE_FOOTER;
|
||||
|
||||
|
||||
server->send(200, "text/html", html);
|
||||
Serial.printf("[%lu] [WEB] Served file listing page for path: %s\n", millis(), currentPath.c_str());
|
||||
}
|
||||
@ -1235,13 +1246,13 @@ static String uploadError = "";
|
||||
|
||||
void CrossPointWebServer::handleUpload() {
|
||||
HTTPUpload& upload = server->upload();
|
||||
|
||||
|
||||
if (upload.status == UPLOAD_FILE_START) {
|
||||
uploadFileName = upload.filename;
|
||||
uploadSize = 0;
|
||||
uploadSuccess = false;
|
||||
uploadError = "";
|
||||
|
||||
|
||||
// Get upload path from query parameter (defaults to root if not specified)
|
||||
// Note: We use query parameter instead of form data because multipart form
|
||||
// fields aren't available until after file upload completes
|
||||
@ -1258,27 +1269,27 @@ void CrossPointWebServer::handleUpload() {
|
||||
} else {
|
||||
uploadPath = "/";
|
||||
}
|
||||
|
||||
|
||||
Serial.printf("[%lu] [WEB] Upload start: %s to path: %s\n", millis(), uploadFileName.c_str(), uploadPath.c_str());
|
||||
|
||||
|
||||
// Validate file extension
|
||||
if (!isEpubFile(uploadFileName)) {
|
||||
uploadError = "Only .epub files are allowed";
|
||||
Serial.printf("[%lu] [WEB] Upload rejected - not an epub file\n", millis());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create file path
|
||||
String filePath = uploadPath;
|
||||
if (!filePath.endsWith("/")) filePath += "/";
|
||||
filePath += uploadFileName;
|
||||
|
||||
|
||||
// Check if file already exists
|
||||
if (SD.exists(filePath.c_str())) {
|
||||
Serial.printf("[%lu] [WEB] Overwriting existing file: %s\n", millis(), filePath.c_str());
|
||||
SD.remove(filePath.c_str());
|
||||
}
|
||||
|
||||
|
||||
// Open file for writing
|
||||
uploadFile = SD.open(filePath.c_str(), FILE_WRITE);
|
||||
if (!uploadFile) {
|
||||
@ -1286,10 +1297,9 @@ void CrossPointWebServer::handleUpload() {
|
||||
Serial.printf("[%lu] [WEB] Failed to create file: %s\n", millis(), filePath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Serial.printf("[%lu] [WEB] File created: %s\n", millis(), filePath.c_str());
|
||||
}
|
||||
else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||
if (uploadFile && uploadError.isEmpty()) {
|
||||
size_t written = uploadFile.write(upload.buf, upload.currentSize);
|
||||
if (written != upload.currentSize) {
|
||||
@ -1300,18 +1310,16 @@ void CrossPointWebServer::handleUpload() {
|
||||
uploadSize += written;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (upload.status == UPLOAD_FILE_END) {
|
||||
} else if (upload.status == UPLOAD_FILE_END) {
|
||||
if (uploadFile) {
|
||||
uploadFile.close();
|
||||
|
||||
|
||||
if (uploadError.isEmpty()) {
|
||||
uploadSuccess = true;
|
||||
Serial.printf("[%lu] [WEB] Upload complete: %s (%d bytes)\n", millis(), uploadFileName.c_str(), uploadSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (upload.status == UPLOAD_FILE_ABORTED) {
|
||||
} else if (upload.status == UPLOAD_FILE_ABORTED) {
|
||||
if (uploadFile) {
|
||||
uploadFile.close();
|
||||
// Try to delete the incomplete file
|
||||
@ -1340,15 +1348,15 @@ void CrossPointWebServer::handleCreateFolder() {
|
||||
server->send(400, "text/plain", "Missing folder name");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String folderName = server->arg("name");
|
||||
|
||||
|
||||
// Validate folder name
|
||||
if (folderName.isEmpty()) {
|
||||
server->send(400, "text/plain", "Folder name cannot be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get parent path
|
||||
String parentPath = "/";
|
||||
if (server->hasArg("path")) {
|
||||
@ -1360,20 +1368,20 @@ void CrossPointWebServer::handleCreateFolder() {
|
||||
parentPath = parentPath.substring(0, parentPath.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build full folder path
|
||||
String folderPath = parentPath;
|
||||
if (!folderPath.endsWith("/")) folderPath += "/";
|
||||
folderPath += folderName;
|
||||
|
||||
|
||||
Serial.printf("[%lu] [WEB] Creating folder: %s\n", millis(), folderPath.c_str());
|
||||
|
||||
|
||||
// Check if already exists
|
||||
if (SD.exists(folderPath.c_str())) {
|
||||
server->send(400, "text/plain", "Folder already exists");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create the folder
|
||||
if (SD.mkdir(folderPath.c_str())) {
|
||||
Serial.printf("[%lu] [WEB] Folder created successfully: %s\n", millis(), folderPath.c_str());
|
||||
@ -1390,31 +1398,31 @@ void CrossPointWebServer::handleDelete() {
|
||||
server->send(400, "text/plain", "Missing path");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String itemPath = server->arg("path");
|
||||
String itemType = server->hasArg("type") ? server->arg("type") : "file";
|
||||
|
||||
|
||||
// Validate path
|
||||
if (itemPath.isEmpty() || itemPath == "/") {
|
||||
server->send(400, "text/plain", "Cannot delete root directory");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Ensure path starts with /
|
||||
if (!itemPath.startsWith("/")) {
|
||||
itemPath = "/" + itemPath;
|
||||
}
|
||||
|
||||
|
||||
// Security check: prevent deletion of protected items
|
||||
String itemName = itemPath.substring(itemPath.lastIndexOf('/') + 1);
|
||||
|
||||
|
||||
// Check if item starts with a dot (hidden/system file)
|
||||
if (itemName.startsWith(".")) {
|
||||
Serial.printf("[%lu] [WEB] Delete rejected - hidden/system item: %s\n", millis(), itemPath.c_str());
|
||||
server->send(403, "text/plain", "Cannot delete system files");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check against explicitly protected items
|
||||
for (size_t i = 0; i < HIDDEN_ITEMS_COUNT; i++) {
|
||||
if (itemName.equals(HIDDEN_ITEMS[i])) {
|
||||
@ -1423,18 +1431,18 @@ void CrossPointWebServer::handleDelete() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if item exists
|
||||
if (!SD.exists(itemPath.c_str())) {
|
||||
Serial.printf("[%lu] [WEB] Delete failed - item not found: %s\n", millis(), itemPath.c_str());
|
||||
server->send(404, "text/plain", "Item not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Serial.printf("[%lu] [WEB] Attempting to delete %s: %s\n", millis(), itemType.c_str(), itemPath.c_str());
|
||||
|
||||
|
||||
bool success = false;
|
||||
|
||||
|
||||
if (itemType == "folder") {
|
||||
// For folders, try to remove (will fail if not empty)
|
||||
File dir = SD.open(itemPath.c_str());
|
||||
@ -1456,7 +1464,7 @@ void CrossPointWebServer::handleDelete() {
|
||||
// For files, use remove
|
||||
success = SD.remove(itemPath.c_str());
|
||||
}
|
||||
|
||||
|
||||
if (success) {
|
||||
Serial.printf("[%lu] [WEB] Successfully deleted: %s\n", millis(), itemPath.c_str());
|
||||
server->send(200, "text/plain", "Deleted successfully");
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -17,8 +17,7 @@ constexpr char WIFI_FILE[] = "/sd/.crosspoint/wifi.bin";
|
||||
|
||||
// Obfuscation key - "CrossPoint" in ASCII
|
||||
// This is NOT cryptographic security, just prevents casual file reading
|
||||
constexpr uint8_t OBFUSCATION_KEY[] = {0x43, 0x72, 0x6F, 0x73, 0x73,
|
||||
0x50, 0x6F, 0x69, 0x6E, 0x74};
|
||||
constexpr uint8_t OBFUSCATION_KEY[] = {0x43, 0x72, 0x6F, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74};
|
||||
constexpr size_t KEY_LENGTH = sizeof(OBFUSCATION_KEY);
|
||||
|
||||
void WifiCredentialStore::obfuscate(std::string& data) const {
|
||||
@ -46,7 +45,8 @@ bool WifiCredentialStore::saveToFile() const {
|
||||
for (const auto& cred : credentials) {
|
||||
// Write SSID (plaintext - not sensitive)
|
||||
serialization::writeString(file, cred.ssid);
|
||||
Serial.printf("[%lu] [WCS] Saving SSID: %s, password length: %zu\n", millis(), cred.ssid.c_str(), cred.password.size());
|
||||
Serial.printf("[%lu] [WCS] Saving SSID: %s, password length: %zu\n", millis(), cred.ssid.c_str(),
|
||||
cred.password.size());
|
||||
|
||||
// Write password (obfuscated)
|
||||
std::string obfuscatedPwd = cred.password;
|
||||
@ -94,7 +94,8 @@ bool WifiCredentialStore::loadFromFile() {
|
||||
|
||||
// Read and deobfuscate password
|
||||
serialization::readString(file, cred.password);
|
||||
Serial.printf("[%lu] [WCS] Loaded SSID: %s, obfuscated password length: %zu\n", millis(), cred.ssid.c_str(), cred.password.size());
|
||||
Serial.printf("[%lu] [WCS] Loaded SSID: %s, obfuscated password length: %zu\n", millis(), cred.ssid.c_str(),
|
||||
cred.password.size());
|
||||
obfuscate(cred.password); // XOR is symmetric, so same function deobfuscates
|
||||
Serial.printf("[%lu] [WCS] After deobfuscation, password length: %zu\n", millis(), cred.password.size());
|
||||
|
||||
@ -148,9 +149,7 @@ const WifiCredential* WifiCredentialStore::findCredential(const std::string& ssi
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool WifiCredentialStore::hasSavedCredential(const std::string& ssid) const {
|
||||
return findCredential(ssid) != nullptr;
|
||||
}
|
||||
bool WifiCredentialStore::hasSavedCredential(const std::string& ssid) const { return findCredential(ssid) != nullptr; }
|
||||
|
||||
void WifiCredentialStore::clearAll() {
|
||||
credentials.clear();
|
||||
|
||||
@ -4,25 +4,16 @@
|
||||
|
||||
// Keyboard layouts - lowercase
|
||||
const char* const OnScreenKeyboard::keyboard[NUM_ROWS] = {
|
||||
"`1234567890-=",
|
||||
"qwertyuiop[]\\",
|
||||
"asdfghjkl;'",
|
||||
"zxcvbnm,./",
|
||||
"`1234567890-=", "qwertyuiop[]\\", "asdfghjkl;'", "zxcvbnm,./",
|
||||
"^ _____<OK" // ^ = shift, _ = space, < = backspace, OK = done
|
||||
};
|
||||
|
||||
// Keyboard layouts - uppercase/symbols
|
||||
const char* const OnScreenKeyboard::keyboardShift[NUM_ROWS] = {
|
||||
"~!@#$%^&*()_+",
|
||||
"QWERTYUIOP{}|",
|
||||
"ASDFGHJKL:\"",
|
||||
"ZXCVBNM<>?",
|
||||
"^ _____<OK"
|
||||
};
|
||||
const char* const OnScreenKeyboard::keyboardShift[NUM_ROWS] = {"~!@#$%^&*()_+", "QWERTYUIOP{}|", "ASDFGHJKL:\"",
|
||||
"ZXCVBNM<>?", "^ _____<OK"};
|
||||
|
||||
OnScreenKeyboard::OnScreenKeyboard(GfxRenderer& renderer, InputManager& inputManager,
|
||||
const std::string& title, const std::string& initialText,
|
||||
size_t maxLength, bool isPassword)
|
||||
OnScreenKeyboard::OnScreenKeyboard(GfxRenderer& renderer, InputManager& inputManager, const std::string& title,
|
||||
const std::string& initialText, size_t maxLength, bool isPassword)
|
||||
: renderer(renderer),
|
||||
inputManager(inputManager),
|
||||
title(title),
|
||||
@ -51,24 +42,30 @@ void OnScreenKeyboard::reset(const std::string& newTitle, const std::string& new
|
||||
|
||||
int OnScreenKeyboard::getRowLength(int row) const {
|
||||
if (row < 0 || row >= NUM_ROWS) return 0;
|
||||
|
||||
|
||||
// Return actual length of each row based on keyboard layout
|
||||
switch (row) {
|
||||
case 0: return 13; // `1234567890-=
|
||||
case 1: return 13; // qwertyuiop[]backslash
|
||||
case 2: return 11; // asdfghjkl;'
|
||||
case 3: return 10; // zxcvbnm,./
|
||||
case 4: return 10; // ^, space (5 wide), backspace, OK (2 wide)
|
||||
default: return 0;
|
||||
case 0:
|
||||
return 13; // `1234567890-=
|
||||
case 1:
|
||||
return 13; // qwertyuiop[]backslash
|
||||
case 2:
|
||||
return 11; // asdfghjkl;'
|
||||
case 3:
|
||||
return 10; // zxcvbnm,./
|
||||
case 4:
|
||||
return 10; // ^, space (5 wide), backspace, OK (2 wide)
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
char OnScreenKeyboard::getSelectedChar() const {
|
||||
const char* const* layout = shiftActive ? keyboardShift : keyboard;
|
||||
|
||||
|
||||
if (selectedRow < 0 || selectedRow >= NUM_ROWS) return '\0';
|
||||
if (selectedCol < 0 || selectedCol >= getRowLength(selectedRow)) return '\0';
|
||||
|
||||
|
||||
return layout[selectedRow][selectedCol];
|
||||
}
|
||||
|
||||
@ -80,7 +77,7 @@ void OnScreenKeyboard::handleKeyPress() {
|
||||
shiftActive = !shiftActive;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (selectedCol >= SPACE_COL && selectedCol < BACKSPACE_COL) {
|
||||
// Space bar
|
||||
if (maxLength == 0 || text.length() < maxLength) {
|
||||
@ -88,7 +85,7 @@ void OnScreenKeyboard::handleKeyPress() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (selectedCol == BACKSPACE_COL) {
|
||||
// Backspace
|
||||
if (!text.empty()) {
|
||||
@ -96,7 +93,7 @@ void OnScreenKeyboard::handleKeyPress() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (selectedCol >= DONE_COL) {
|
||||
// Done button
|
||||
complete = true;
|
||||
@ -106,7 +103,7 @@ void OnScreenKeyboard::handleKeyPress() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Regular character
|
||||
char c = getSelectedChar();
|
||||
if (c != '\0' && c != '^' && c != '_' && c != '<') {
|
||||
@ -184,24 +181,24 @@ bool OnScreenKeyboard::handleInput() {
|
||||
|
||||
void OnScreenKeyboard::render(int startY) const {
|
||||
const auto pageWidth = GfxRenderer::getScreenWidth();
|
||||
|
||||
|
||||
// Draw title
|
||||
renderer.drawCenteredText(UI_FONT_ID, startY, title.c_str(), true, REGULAR);
|
||||
|
||||
|
||||
// Draw input field
|
||||
int inputY = startY + 22;
|
||||
renderer.drawText(UI_FONT_ID, 10, inputY, "[");
|
||||
|
||||
|
||||
std::string displayText;
|
||||
if (isPassword) {
|
||||
displayText = std::string(text.length(), '*');
|
||||
} else {
|
||||
displayText = text;
|
||||
}
|
||||
|
||||
|
||||
// Show cursor at end
|
||||
displayText += "_";
|
||||
|
||||
|
||||
// Truncate if too long for display - use actual character width from font
|
||||
int charWidth = renderer.getSpaceWidth(UI_FONT_ID);
|
||||
if (charWidth < 1) charWidth = 8; // Fallback to approximate width
|
||||
@ -209,35 +206,35 @@ void OnScreenKeyboard::render(int startY) const {
|
||||
if (displayText.length() > static_cast<size_t>(maxDisplayLen)) {
|
||||
displayText = "..." + displayText.substr(displayText.length() - maxDisplayLen + 3);
|
||||
}
|
||||
|
||||
|
||||
renderer.drawText(UI_FONT_ID, 20, inputY, displayText.c_str());
|
||||
renderer.drawText(UI_FONT_ID, pageWidth - 15, inputY, "]");
|
||||
|
||||
|
||||
// Draw keyboard - use compact spacing to fit 5 rows on screen
|
||||
int keyboardStartY = inputY + 25;
|
||||
const int keyWidth = 18;
|
||||
const int keyHeight = 18;
|
||||
const int keySpacing = 3;
|
||||
|
||||
|
||||
const char* const* layout = shiftActive ? keyboardShift : keyboard;
|
||||
|
||||
|
||||
// Calculate left margin to center the longest row (13 keys)
|
||||
int maxRowWidth = KEYS_PER_ROW * (keyWidth + keySpacing);
|
||||
int leftMargin = (pageWidth - maxRowWidth) / 2;
|
||||
|
||||
|
||||
for (int row = 0; row < NUM_ROWS; row++) {
|
||||
int rowY = keyboardStartY + row * (keyHeight + keySpacing);
|
||||
|
||||
|
||||
// Left-align all rows for consistent navigation
|
||||
int startX = leftMargin;
|
||||
|
||||
|
||||
// Handle bottom row (row 4) specially with proper multi-column keys
|
||||
if (row == 4) {
|
||||
// Bottom row layout: CAPS (2 cols) | SPACE (5 cols) | <- (2 cols) | OK (2 cols)
|
||||
// Total: 11 visual columns, but we use logical positions for selection
|
||||
|
||||
|
||||
int currentX = startX;
|
||||
|
||||
|
||||
// CAPS key (logical col 0, spans 2 key widths)
|
||||
int capsWidth = 2 * keyWidth + keySpacing;
|
||||
bool capsSelected = (selectedRow == 4 && selectedCol == SHIFT_COL);
|
||||
@ -247,7 +244,7 @@ void OnScreenKeyboard::render(int startY) const {
|
||||
}
|
||||
renderer.drawText(UI_FONT_ID, currentX + 2, rowY, shiftActive ? "CAPS" : "caps");
|
||||
currentX += capsWidth + keySpacing;
|
||||
|
||||
|
||||
// Space bar (logical cols 2-6, spans 5 key widths)
|
||||
int spaceWidth = 5 * keyWidth + 4 * keySpacing;
|
||||
bool spaceSelected = (selectedRow == 4 && selectedCol >= SPACE_COL && selectedCol < BACKSPACE_COL);
|
||||
@ -259,7 +256,7 @@ void OnScreenKeyboard::render(int startY) const {
|
||||
int spaceTextX = currentX + (spaceWidth / 2) - 12;
|
||||
renderer.drawText(UI_FONT_ID, spaceTextX, rowY, "_____");
|
||||
currentX += spaceWidth + keySpacing;
|
||||
|
||||
|
||||
// Backspace key (logical col 7, spans 2 key widths)
|
||||
int bsWidth = 2 * keyWidth + keySpacing;
|
||||
bool bsSelected = (selectedRow == 4 && selectedCol == BACKSPACE_COL);
|
||||
@ -269,7 +266,7 @@ void OnScreenKeyboard::render(int startY) const {
|
||||
}
|
||||
renderer.drawText(UI_FONT_ID, currentX + 6, rowY, "<-");
|
||||
currentX += bsWidth + keySpacing;
|
||||
|
||||
|
||||
// OK button (logical col 9, spans 2 key widths)
|
||||
int okWidth = 2 * keyWidth + keySpacing;
|
||||
bool okSelected = (selectedRow == 4 && selectedCol >= DONE_COL);
|
||||
@ -278,29 +275,29 @@ void OnScreenKeyboard::render(int startY) const {
|
||||
renderer.drawText(UI_FONT_ID, currentX + okWidth - 4, rowY, "]");
|
||||
}
|
||||
renderer.drawText(UI_FONT_ID, currentX + 8, rowY, "OK");
|
||||
|
||||
|
||||
} else {
|
||||
// Regular rows: render each key individually
|
||||
for (int col = 0; col < getRowLength(row); col++) {
|
||||
int keyX = startX + col * (keyWidth + keySpacing);
|
||||
|
||||
|
||||
// Get the character to display
|
||||
char c = layout[row][col];
|
||||
std::string keyLabel(1, c);
|
||||
|
||||
|
||||
// Draw selection highlight
|
||||
bool isSelected = (row == selectedRow && col == selectedCol);
|
||||
|
||||
|
||||
if (isSelected) {
|
||||
renderer.drawText(UI_FONT_ID, keyX - 2, rowY, "[");
|
||||
renderer.drawText(UI_FONT_ID, keyX + keyWidth - 4, rowY, "]");
|
||||
}
|
||||
|
||||
|
||||
renderer.drawText(UI_FONT_ID, keyX + 2, rowY, keyLabel.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw help text at absolute bottom of screen (consistent with other screens)
|
||||
const auto pageHeight = GfxRenderer::getScreenHeight();
|
||||
renderer.drawText(SMALL_FONT_ID, 10, pageHeight - 30, "Navigate: D-pad | Select: OK | Cancel: BACK");
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
/**
|
||||
* Reusable on-screen keyboard component for text input.
|
||||
* Can be embedded in any screen that needs text entry.
|
||||
*
|
||||
*
|
||||
* Usage:
|
||||
* 1. Create an OnScreenKeyboard instance
|
||||
* 2. Call render() to draw the keyboard
|
||||
@ -31,11 +31,8 @@ class OnScreenKeyboard {
|
||||
* @param maxLength Maximum length of input text (0 for unlimited)
|
||||
* @param isPassword If true, display asterisks instead of actual characters
|
||||
*/
|
||||
OnScreenKeyboard(GfxRenderer& renderer, InputManager& inputManager,
|
||||
const std::string& title = "Enter Text",
|
||||
const std::string& initialText = "",
|
||||
size_t maxLength = 0,
|
||||
bool isPassword = false);
|
||||
OnScreenKeyboard(GfxRenderer& renderer, InputManager& inputManager, const std::string& title = "Enter Text",
|
||||
const std::string& initialText = "", size_t maxLength = 0, bool isPassword = false);
|
||||
|
||||
/**
|
||||
* Handle button input. Call this in your screen's handleInput().
|
||||
@ -87,19 +84,19 @@ class OnScreenKeyboard {
|
||||
private:
|
||||
GfxRenderer& renderer;
|
||||
InputManager& inputManager;
|
||||
|
||||
|
||||
std::string title;
|
||||
std::string text;
|
||||
size_t maxLength;
|
||||
bool isPassword;
|
||||
|
||||
|
||||
// Keyboard state
|
||||
int selectedRow = 0;
|
||||
int selectedCol = 0;
|
||||
bool shiftActive = false;
|
||||
bool complete = false;
|
||||
bool cancelled = false;
|
||||
|
||||
|
||||
// Callbacks
|
||||
OnCompleteCallback onComplete;
|
||||
OnCancelCallback onCancel;
|
||||
@ -109,7 +106,7 @@ class OnScreenKeyboard {
|
||||
static constexpr int KEYS_PER_ROW = 13; // Max keys per row (rows 0 and 1 have 13 keys)
|
||||
static const char* const keyboard[NUM_ROWS];
|
||||
static const char* const keyboardShift[NUM_ROWS];
|
||||
|
||||
|
||||
// Special key positions (bottom row)
|
||||
static constexpr int SHIFT_ROW = 4;
|
||||
static constexpr int SHIFT_COL = 0;
|
||||
|
||||
@ -100,7 +100,7 @@ void SettingsScreen::toggleCurrentSetting() {
|
||||
}
|
||||
|
||||
const auto& setting = settingsList[selectedSettingIndex];
|
||||
|
||||
|
||||
// Only toggle if it's a toggle type and has a value pointer
|
||||
if (setting.type != SettingType::TOGGLE || setting.valuePtr == nullptr) {
|
||||
return;
|
||||
|
||||
@ -17,9 +17,9 @@ enum class SettingType { TOGGLE, ACTION };
|
||||
|
||||
// Structure to hold setting information
|
||||
struct SettingInfo {
|
||||
const char* name; // Display name of the setting
|
||||
SettingType type; // Type of setting
|
||||
uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings (for TOGGLE)
|
||||
const char* name; // Display name of the setting
|
||||
SettingType type; // Type of setting
|
||||
uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings (for TOGGLE)
|
||||
};
|
||||
|
||||
class SettingsScreen final : public Screen {
|
||||
@ -41,9 +41,8 @@ class SettingsScreen final : public Screen {
|
||||
void activateCurrentSetting();
|
||||
|
||||
public:
|
||||
explicit SettingsScreen(GfxRenderer& renderer, InputManager& inputManager,
|
||||
const std::function<void()>& onGoHome,
|
||||
const std::function<void()>& onGoWifi)
|
||||
explicit SettingsScreen(GfxRenderer& renderer, InputManager& inputManager, const std::function<void()>& onGoHome,
|
||||
const std::function<void()>& onGoWifi)
|
||||
: Screen(renderer, inputManager), onGoHome(onGoHome), onGoWifi(onGoWifi) {}
|
||||
void onEnter() override;
|
||||
void onExit() override;
|
||||
|
||||
@ -48,10 +48,10 @@ void WifiScreen::onEnter() {
|
||||
void WifiScreen::onExit() {
|
||||
// Stop any ongoing WiFi scan
|
||||
WiFi.scanDelete();
|
||||
|
||||
|
||||
// Stop the web server to free memory
|
||||
crossPointWebServer.stop();
|
||||
|
||||
|
||||
// Disconnect WiFi to free memory
|
||||
WiFi.disconnect(true);
|
||||
WiFi.mode(WIFI_OFF);
|
||||
@ -136,7 +136,8 @@ void WifiScreen::selectNetwork(int index) {
|
||||
// Use saved password - connect directly
|
||||
enteredPassword = savedCred->password;
|
||||
usedSavedPassword = true;
|
||||
Serial.printf("[%lu] [WiFi] Using saved password for %s, length: %zu\n", millis(), selectedSSID.c_str(), enteredPassword.size());
|
||||
Serial.printf("[%lu] [WiFi] Using saved password for %s, length: %zu\n", millis(), selectedSSID.c_str(),
|
||||
enteredPassword.size());
|
||||
attemptConnection();
|
||||
return;
|
||||
}
|
||||
@ -144,13 +145,11 @@ void WifiScreen::selectNetwork(int index) {
|
||||
if (selectedRequiresPassword) {
|
||||
// Show password entry
|
||||
state = WifiScreenState::PASSWORD_ENTRY;
|
||||
keyboard.reset(new OnScreenKeyboard(
|
||||
renderer, inputManager,
|
||||
"Enter WiFi Password",
|
||||
"", // No initial text
|
||||
64, // Max password length
|
||||
false // Show password by default (hard keyboard to use)
|
||||
));
|
||||
keyboard.reset(new OnScreenKeyboard(renderer, inputManager, "Enter WiFi Password",
|
||||
"", // No initial text
|
||||
64, // Max password length
|
||||
false // Show password by default (hard keyboard to use)
|
||||
));
|
||||
updateRequired = true;
|
||||
} else {
|
||||
// Connect directly for open networks
|
||||
@ -166,12 +165,12 @@ void WifiScreen::attemptConnection() {
|
||||
updateRequired = true;
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
|
||||
// Get password from keyboard if we just entered it
|
||||
if (keyboard && !usedSavedPassword) {
|
||||
enteredPassword = keyboard->getText();
|
||||
}
|
||||
|
||||
|
||||
if (selectedRequiresPassword && !enteredPassword.empty()) {
|
||||
WiFi.begin(selectedSSID.c_str(), enteredPassword.c_str());
|
||||
} else {
|
||||
@ -185,17 +184,17 @@ void WifiScreen::checkConnectionStatus() {
|
||||
}
|
||||
|
||||
wl_status_t status = WiFi.status();
|
||||
|
||||
|
||||
if (status == WL_CONNECTED) {
|
||||
// Successfully connected
|
||||
IPAddress ip = WiFi.localIP();
|
||||
char ipStr[16];
|
||||
snprintf(ipStr, sizeof(ipStr), "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
connectedIP = ipStr;
|
||||
|
||||
|
||||
// Start the web server
|
||||
crossPointWebServer.begin();
|
||||
|
||||
|
||||
// If we used a saved password, go directly to connected screen
|
||||
// If we entered a new password, ask if user wants to save it
|
||||
if (usedSavedPassword || enteredPassword.empty()) {
|
||||
@ -244,33 +243,31 @@ void WifiScreen::handleInput() {
|
||||
// Handle password entry state
|
||||
if (state == WifiScreenState::PASSWORD_ENTRY && keyboard) {
|
||||
keyboard->handleInput();
|
||||
|
||||
|
||||
if (keyboard->isComplete()) {
|
||||
attemptConnection();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (keyboard->isCancelled()) {
|
||||
state = WifiScreenState::NETWORK_LIST;
|
||||
keyboard.reset();
|
||||
updateRequired = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
updateRequired = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle save prompt state
|
||||
if (state == WifiScreenState::SAVE_PROMPT) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_LEFT) ||
|
||||
inputManager.wasPressed(InputManager::BTN_UP)) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_LEFT) || inputManager.wasPressed(InputManager::BTN_UP)) {
|
||||
if (savePromptSelection > 0) {
|
||||
savePromptSelection--;
|
||||
updateRequired = true;
|
||||
}
|
||||
} else if (inputManager.wasPressed(InputManager::BTN_RIGHT) ||
|
||||
inputManager.wasPressed(InputManager::BTN_DOWN)) {
|
||||
} else if (inputManager.wasPressed(InputManager::BTN_RIGHT) || inputManager.wasPressed(InputManager::BTN_DOWN)) {
|
||||
if (savePromptSelection < 1) {
|
||||
savePromptSelection++;
|
||||
updateRequired = true;
|
||||
@ -293,14 +290,12 @@ void WifiScreen::handleInput() {
|
||||
|
||||
// Handle forget prompt state (connection failed with saved credentials)
|
||||
if (state == WifiScreenState::FORGET_PROMPT) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_LEFT) ||
|
||||
inputManager.wasPressed(InputManager::BTN_UP)) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_LEFT) || inputManager.wasPressed(InputManager::BTN_UP)) {
|
||||
if (forgetPromptSelection > 0) {
|
||||
forgetPromptSelection--;
|
||||
updateRequired = true;
|
||||
}
|
||||
} else if (inputManager.wasPressed(InputManager::BTN_RIGHT) ||
|
||||
inputManager.wasPressed(InputManager::BTN_DOWN)) {
|
||||
} else if (inputManager.wasPressed(InputManager::BTN_RIGHT) || inputManager.wasPressed(InputManager::BTN_DOWN)) {
|
||||
if (forgetPromptSelection < 1) {
|
||||
forgetPromptSelection++;
|
||||
updateRequired = true;
|
||||
@ -330,8 +325,7 @@ void WifiScreen::handleInput() {
|
||||
|
||||
// Handle connected state
|
||||
if (state == WifiScreenState::CONNECTED) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK) ||
|
||||
inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK) || inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
// Exit screen on success
|
||||
onGoBack();
|
||||
return;
|
||||
@ -340,8 +334,7 @@ void WifiScreen::handleInput() {
|
||||
|
||||
// Handle connection failed state
|
||||
if (state == WifiScreenState::CONNECTION_FAILED) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK) ||
|
||||
inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK) || inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
// If we used saved credentials, offer to forget the network
|
||||
if (usedSavedPassword) {
|
||||
state = WifiScreenState::FORGET_PROMPT;
|
||||
@ -551,7 +544,7 @@ void WifiScreen::renderConnecting() const {
|
||||
renderer.drawCenteredText(UI_FONT_ID, top, "Scanning...", true, REGULAR);
|
||||
} else {
|
||||
renderer.drawCenteredText(READER_FONT_ID, top - 30, "Connecting...", true, BOLD);
|
||||
|
||||
|
||||
std::string ssidInfo = "to " + selectedSSID;
|
||||
if (ssidInfo.length() > 25) {
|
||||
ssidInfo = ssidInfo.substr(0, 22) + "...";
|
||||
|
||||
@ -54,10 +54,10 @@ class WifiScreen final : public Screen {
|
||||
|
||||
// Password to potentially save (from keyboard or saved credentials)
|
||||
std::string enteredPassword;
|
||||
|
||||
|
||||
// Whether network was connected using a saved password (skip save prompt)
|
||||
bool usedSavedPassword = false;
|
||||
|
||||
|
||||
// Save/forget prompt selection (0 = Yes, 1 = No)
|
||||
int savePromptSelection = 0;
|
||||
int forgetPromptSelection = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user