Avoid multiple Access-Control-Allow-Origin * (#1859)

* Avoid multiple Access-Control-Allow-Origin *

* Adapt loglevel to debug
This commit is contained in:
Slider0007
2023-01-16 23:07:28 +01:00
committed by GitHub
parent 22ef80db37
commit 86304524e2

View File

@@ -55,8 +55,6 @@ void CheckIsPlannedReboot()
DeleteFile("/sdcard/reboot.txt"); // Prevent Boot Loop!!! DeleteFile("/sdcard/reboot.txt"); // Prevent Boot Loop!!!
isPlannedReboot = true; isPlannedReboot = true;
} }
} }
@@ -462,8 +460,6 @@ esp_err_t handler_editflow(httpd_req_t *req)
char _valuechar[30]; char _valuechar[30];
string _task; string _task;
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK) if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
{ {
if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK) if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
@@ -477,13 +473,13 @@ esp_err_t handler_editflow(httpd_req_t *req)
if (_task.compare("namenumbers") == 0) if (_task.compare("namenumbers") == 0)
{ {
ESP_LOGI(TAG, "Get NUMBER list"); ESP_LOGD(TAG, "Get NUMBER list");
return get_numbers_file_handler(req); return get_numbers_file_handler(req);
} }
if (_task.compare("data") == 0) if (_task.compare("data") == 0)
{ {
ESP_LOGI(TAG, "Get data list"); ESP_LOGD(TAG, "Get data list");
return get_data_file_handler(req); return get_data_file_handler(req);
} }
@@ -513,6 +509,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
CopyFile(in, out); CopyFile(in, out);
zw = "Copy Done"; zw = "Copy Done";
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
httpd_resp_send(req, zw.c_str(), zw.length()); httpd_resp_send(req, zw.c_str(), zw.length());
} }
@@ -582,6 +579,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
delete cim; delete cim;
zw = "CutImage Done"; zw = "CutImage Done";
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
httpd_resp_send(req, zw.c_str(), zw.length()); httpd_resp_send(req, zw.c_str(), zw.length());
} }
@@ -625,6 +623,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
Camera.SetLEDIntensity(intens); Camera.SetLEDIntensity(intens);
ESP_LOGD(TAG, "test_take - vor MakeImage"); ESP_LOGD(TAG, "test_take - vor MakeImage");
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host); std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
httpd_resp_send(req, zw.c_str(), zw.length()); httpd_resp_send(req, zw.c_str(), zw.length());
} }
@@ -639,6 +638,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
// string zwzw = "Do " + _task + " start\n"; ESP_LOGD(TAG, zwzw.c_str()); // string zwzw = "Do " + _task + " start\n"; ESP_LOGD(TAG, zwzw.c_str());
std::string zw = tfliteflow.doSingleStep("[Alignment]", _host); std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
httpd_resp_send(req, zw.c_str(), zw.length()); httpd_resp_send(req, zw.c_str(), zw.length());
} }