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()
|
||||
{
|
||||
if (!configs.feature.webserver_disable_lock.value)
|
||||
{
|
||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
webserver_lock.construct();
|
||||
webserver_lock->take(portMAX_DELAY);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
httpd_config_t httpConfig HTTPD_DEFAULT_CONFIG();
|
||||
@@ -92,12 +91,11 @@ void initWebserver()
|
||||
|
||||
void handleWebserver()
|
||||
{
|
||||
if (!configs.feature.webserver_disable_lock.value)
|
||||
{
|
||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
webserver_lock->give();
|
||||
vTaskDelay(1);
|
||||
webserver_lock->take(portMAX_DELAY);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -158,8 +156,7 @@ bool menuDisplayChanged()
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -167,7 +164,7 @@ esp_err_t webserver_status_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
|
@@ -33,8 +33,7 @@ constexpr const char * const TAG = "BOBBYWEB";
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -42,7 +41,7 @@ esp_err_t webserver_root_handler(httpd_req_t *req)
|
||||
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;
|
||||
|
||||
@@ -283,8 +282,7 @@ esp_err_t webserver_root_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())
|
||||
{
|
||||
@@ -292,7 +290,7 @@ esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
|
||||
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;
|
||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||
@@ -358,8 +356,7 @@ esp_err_t webserver_triggerRawButton_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())
|
||||
{
|
||||
@@ -367,7 +364,7 @@ esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
|
||||
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;
|
||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||
@@ -433,8 +430,7 @@ esp_err_t webserver_triggerButton_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())
|
||||
{
|
||||
@@ -442,7 +438,7 @@ esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
@@ -524,8 +520,7 @@ esp_err_t webserver_triggerItem_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())
|
||||
{
|
||||
@@ -533,7 +528,7 @@ esp_err_t webserver_setValue_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
|
@@ -128,8 +128,7 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -137,7 +136,8 @@ esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
|
||||
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);
|
||||
|
||||
JsonObject settings = doc.createNestedObject("settings");
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#include "webserver_lock.h"
|
||||
|
||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
||||
#endif
|
||||
|
@@ -4,4 +4,6 @@
|
||||
#include <delayedconstruction.h>
|
||||
#include <wrappers/mutex_semaphore.h>
|
||||
|
||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
extern cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
|
||||
#endif
|
||||
|
@@ -259,8 +259,7 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
|
||||
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())
|
||||
@@ -269,7 +268,7 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||
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;
|
||||
|
||||
@@ -503,8 +502,7 @@ saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -512,7 +510,7 @@ esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
||||
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;
|
||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||
@@ -573,8 +571,7 @@ esp_err_t webserver_saveNewSettings_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())
|
||||
{
|
||||
@@ -582,7 +579,7 @@ esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req)
|
||||
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;
|
||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||
|
@@ -29,8 +29,7 @@ constexpr const char * const TAG = "BOBBYWEB";
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -38,7 +37,7 @@ esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
@@ -91,8 +90,7 @@ esp_err_t webserver_ota_percentage_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())
|
||||
{
|
||||
@@ -100,7 +98,7 @@ esp_err_t webserver_ota_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
@@ -362,8 +360,7 @@ esp_err_t webserver_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())
|
||||
{
|
||||
@@ -371,7 +368,7 @@ esp_err_t webserver_trigger_ota_handler(httpd_req_t *req)
|
||||
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");
|
||||
|
||||
|
@@ -86,8 +86,7 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -95,7 +94,8 @@ esp_err_t webserver_settings_handler(httpd_req_t *req)
|
||||
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;
|
||||
|
||||
{
|
||||
@@ -252,8 +252,7 @@ saveSetting(T &value, std::string_view newValue, std::string &body)
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -261,7 +260,7 @@ esp_err_t webserver_saveSettings_handler(httpd_req_t *req)
|
||||
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;
|
||||
if (auto result = esphttpdutils::webserver_get_query(req))
|
||||
|
Reference in New Issue
Block a user