Merge develop to main (#334)

- `FileBrowser` app now supports deleting directories (recursively)
- `DevelopmentService` and `tactility.py` now support the app `uninstall` action
- Fix crash for `File` app: implement file locking in several places (SPI SD cards need it)
- Remove I2C configuration from `M5stackCardputer.cpp` because we don't support the "Cardputer Adv" variant in that firmware.
This commit is contained in:
Ken Van Hoeylandt
2025-09-14 13:37:34 +02:00
committed by GitHub
parent 7027da00b8
commit d5c94c7a8a
13 changed files with 182 additions and 53 deletions
@@ -110,6 +110,7 @@ void DevelopmentService::startServer() {
httpd_register_uri_handler(server, &handleGetInfoEndpoint);
httpd_register_uri_handler(server, &appRunEndpoint);
httpd_register_uri_handler(server, &appInstallEndpoint);
httpd_register_uri_handler(server, &appUninstallEndpoint);
TT_LOG_I(TAG, "Started on port %d", config.server_port);
} else {
TT_LOG_E(TAG, "Failed to start");
@@ -297,6 +298,39 @@ esp_err_t DevelopmentService::handleAppInstall(httpd_req_t* request) {
return ESP_OK;
}
esp_err_t DevelopmentService::handleAppUninstall(httpd_req_t* request) {
TT_LOG_I(TAG, "PUT /app/uninstall");
std::string query;
if (!network::getQueryOrSendError(request, query)) {
return ESP_FAIL;
}
auto parameters = network::parseUrlQuery(query);
auto id_key_pos = parameters.find("id");
if (id_key_pos == parameters.end()) {
TT_LOG_W(TAG, "[400] /app/uninstall id not specified");
httpd_resp_send_err(request, HTTPD_400_BAD_REQUEST, "id not specified");
return ESP_FAIL;
}
if (!app::findAppById(id_key_pos->second)) {
TT_LOG_I(TAG, "[200] /app/uninstall %s (app wasn't installed)", id_key_pos->second.c_str());
httpd_resp_send(request, nullptr, 0);
return ESP_OK;
}
if (app::uninstall(id_key_pos->second)) {
TT_LOG_I(TAG, "[200] /app/uninstall %s", id_key_pos->second.c_str());
httpd_resp_send(request, nullptr, 0);
return ESP_OK;
} else {
TT_LOG_W(TAG, "[500] /app/uninstall %s", id_key_pos->second.c_str());
httpd_resp_send_err(request, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to uninstall");
return ESP_FAIL;
}
}
// endregion
std::shared_ptr<DevelopmentService> findService() {