Revert "Moved FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET into config-system"
This reverts commit ccc8eb0e3601e0769988426f3f59713ff6071a61.
This commit is contained in:
@@ -46,11 +46,10 @@ httpd_handle_t httpdHandle;
|
|||||||
|
|
||||||
void initWebserver()
|
void initWebserver()
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
{
|
webserver_lock.construct();
|
||||||
webserver_lock.construct();
|
webserver_lock->take(portMAX_DELAY);
|
||||||
webserver_lock->take(portMAX_DELAY);
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
httpd_config_t httpConfig HTTPD_DEFAULT_CONFIG();
|
httpd_config_t httpConfig HTTPD_DEFAULT_CONFIG();
|
||||||
@@ -92,12 +91,11 @@ void initWebserver()
|
|||||||
|
|
||||||
void handleWebserver()
|
void handleWebserver()
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
{
|
webserver_lock->give();
|
||||||
webserver_lock->give();
|
vTaskDelay(1);
|
||||||
vTaskDelay(1);
|
webserver_lock->take(portMAX_DELAY);
|
||||||
webserver_lock->take(portMAX_DELAY);
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -158,16 +156,15 @@ bool menuDisplayChanged()
|
|||||||
|
|
||||||
esp_err_t webserver_status_handler(httpd_req_t *req)
|
esp_err_t webserver_status_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
|
@@ -33,16 +33,15 @@ constexpr const char * const TAG = "BOBBYWEB";
|
|||||||
|
|
||||||
esp_err_t webserver_root_handler(httpd_req_t *req)
|
esp_err_t webserver_root_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string body;
|
std::string body;
|
||||||
|
|
||||||
@@ -283,16 +282,15 @@ esp_err_t webserver_root_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
|
esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string query;
|
std::string query;
|
||||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||||
@@ -358,16 +356,15 @@ esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
|
esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string query;
|
std::string query;
|
||||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||||
@@ -433,16 +430,15 @@ esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
|
esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
@@ -524,16 +520,15 @@ esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_setValue_handler(httpd_req_t *req)
|
esp_err_t webserver_setValue_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
|
@@ -128,16 +128,16 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
|
|||||||
|
|
||||||
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
|
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DynamicJsonDocument doc(6144);
|
DynamicJsonDocument doc(6144);
|
||||||
|
|
||||||
JsonObject settings = doc.createNestedObject("settings");
|
JsonObject settings = doc.createNestedObject("settings");
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
#include "webserver_lock.h"
|
#include "webserver_lock.h"
|
||||||
|
|
||||||
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
||||||
|
#endif
|
||||||
|
@@ -4,4 +4,6 @@
|
|||||||
#include <delayedconstruction.h>
|
#include <delayedconstruction.h>
|
||||||
#include <wrappers/mutex_semaphore.h>
|
#include <wrappers/mutex_semaphore.h>
|
||||||
|
|
||||||
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
extern cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
extern cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
||||||
|
#endif
|
||||||
|
@@ -259,17 +259,16 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
|||||||
|
|
||||||
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
ESP_LOGI(TAG, "trying to lock...");
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "trying to lock...");
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
if (!helper.locked())
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
{
|
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string body;
|
std::string body;
|
||||||
|
|
||||||
@@ -503,16 +502,15 @@ saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
|||||||
|
|
||||||
esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string query;
|
std::string query;
|
||||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||||
@@ -573,16 +571,15 @@ esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req)
|
esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string query;
|
std::string query;
|
||||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||||
|
@@ -29,16 +29,15 @@ constexpr const char * const TAG = "BOBBYWEB";
|
|||||||
|
|
||||||
esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
|
esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
@@ -91,16 +90,15 @@ esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_ota_handler(httpd_req_t *req)
|
esp_err_t webserver_ota_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
@@ -362,16 +360,15 @@ esp_err_t webserver_ota_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
esp_err_t webserver_trigger_ota_handler(httpd_req_t *req)
|
esp_err_t webserver_trigger_ota_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
|
||||||
|
|
||||||
|
@@ -86,16 +86,16 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
|||||||
|
|
||||||
esp_err_t webserver_settings_handler(httpd_req_t *req)
|
esp_err_t webserver_settings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string body;
|
std::string body;
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -252,16 +252,15 @@ saveSetting(T &value, std::string_view newValue, std::string &body)
|
|||||||
|
|
||||||
esp_err_t webserver_saveSettings_handler(httpd_req_t *req)
|
esp_err_t webserver_saveSettings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
if (!configs.feature.webserver_disable_lock.value)
|
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||||
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
constexpr const std::string_view msg = "could not lock webserver_lock";
|
||||||
if (!helper.locked())
|
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
||||||
{
|
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
||||||
constexpr const std::string_view msg = "could not lock webserver_lock";
|
|
||||||
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
|
|
||||||
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string query;
|
std::string query;
|
||||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||||
|
Reference in New Issue
Block a user