Folder move, multiple items move

This commit is contained in:
jpirnay
2026-04-20 08:44:43 +02:00
parent cf32498fe5
commit c8a02a8daa
3 changed files with 159 additions and 55 deletions
+9 -14
View File
@@ -998,13 +998,6 @@ void CrossPointWebServer::handleMove() const {
server->send(403, "text/plain", "Cannot move protected item");
return;
}
if (destPath != "/") {
const String destName = destPath.substring(destPath.lastIndexOf('/') + 1);
if (isProtectedItemName(destName)) {
server->send(403, "text/plain", "Cannot move into protected folder");
return;
}
}
if (!Storage.exists(itemPath.c_str())) {
server->send(404, "text/plain", "Item not found");
@@ -1210,9 +1203,9 @@ void CrossPointWebServer::handleSettingsPage() const {
void CrossPointWebServer::handleGetSettings() const {
const auto& settings = getSettingsList();
server->setContentLength(CONTENT_LENGTH_UNKNOWN);
server->send(200, "application/json", "");
server->sendContent("[");
String result;
result.reserve(4096);
result += "[";
char output[512];
constexpr size_t outputSize = sizeof(output);
@@ -1226,6 +1219,8 @@ void CrossPointWebServer::handleGetSettings() const {
doc["key"] = s.key;
doc["name"] = I18N.get(s.nameId);
doc["category"] = I18N.get(s.category);
doc["subcategory"] = s.subcategory != StrId::STR_NONE_OPT ? I18N.get(s.subcategory) : "";
doc["submenu"] = s.submenu != StrId::STR_NONE_OPT ? I18N.get(s.submenu) : "";
switch (s.type) {
case SettingType::TOGGLE: {
@@ -1278,15 +1273,15 @@ void CrossPointWebServer::handleGetSettings() const {
}
if (seenFirst) {
server->sendContent(",");
result += ",";
} else {
seenFirst = true;
}
server->sendContent(output);
result += output;
}
server->sendContent("]");
server->sendContent("");
result += "]";
server->send(200, "application/json", result);
LOG_DBG("WEB", "Served settings API");
}