mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
renaming
This commit is contained in:
@@ -38,13 +38,7 @@
|
||||
#include <TickerScheduler.h>
|
||||
#include <Wire.h>
|
||||
#include <time.h>
|
||||
#ifdef OTA_UPDATES_ENABLED
|
||||
#include <ArduinoOTA.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Objects.h(без данных)
|
||||
*/
|
||||
|
||||
#ifdef WEBSOCKET_ENABLED
|
||||
extern AsyncWebSocket ws;
|
||||
@@ -240,7 +234,7 @@ extern void init_updater();
|
||||
// widget
|
||||
extern void createWidget(String widget_name, String page_name, String page_number, String file, String topic);
|
||||
extern void createWidgetParam(String widget_name, String page_name, String page_number, String file, String topic, String name1, String param1, String name2, String param2, String name3, String param3);
|
||||
extern void choose_widget_and_create(String widget_name, String page_name, String page_number, String type, String topik);
|
||||
extern void createWidgetByType(String widget_name, String page_name, String page_number, String type, String topik);
|
||||
extern void createChart(String widget_name, String page_name, String page_number, String file, String topic, String maxCount);
|
||||
|
||||
// PushingBox
|
||||
@@ -255,6 +249,7 @@ extern void do_mqtt_send_settings_to_udp();
|
||||
extern void Web_server_init();
|
||||
|
||||
// iot_firmware
|
||||
extern void addCommandLoop(const String& cmdStr);
|
||||
extern void loopSerial();
|
||||
extern void loopCmd();
|
||||
extern void loopButton();
|
||||
|
||||
9
include/HttpServer.h
Normal file
9
include/HttpServer.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
namespace HttpServer {
|
||||
|
||||
void init();
|
||||
|
||||
} // namespace HttpServer
|
||||
73
include/Utils/WebUtils.h
Normal file
73
include/Utils/WebUtils.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include "ESPAsyncWebServer.h"
|
||||
|
||||
const String getMethodName(AsyncWebServerRequest* request) {
|
||||
String res = F("UNKNOWN");
|
||||
if (request->method() == HTTP_GET)
|
||||
res = F("GET");
|
||||
else if (request->method() == HTTP_POST)
|
||||
res = F("POST");
|
||||
else if (request->method() == HTTP_DELETE)
|
||||
res = F("DELETE");
|
||||
else if (request->method() == HTTP_PUT)
|
||||
res = F("PUT");
|
||||
else if (request->method() == HTTP_PATCH)
|
||||
res = F("PATCH");
|
||||
else if (request->method() == HTTP_HEAD)
|
||||
res = F("HEAD");
|
||||
else if (request->method() == HTTP_OPTIONS)
|
||||
res = F("OPTIONS");
|
||||
return res;
|
||||
}
|
||||
|
||||
const String getRequestInfo(AsyncWebServerRequest* request) {
|
||||
String res = getMethodName(request);
|
||||
res += ' ';
|
||||
res += "http://";
|
||||
res += request->host();
|
||||
res += request->url();
|
||||
res += '\n';
|
||||
if (request->contentLength()) {
|
||||
res += "content-type: ";
|
||||
res += request->contentType();
|
||||
res += " content-lenght: ";
|
||||
res += prettyBytes(request->contentLength());
|
||||
res += '\n';
|
||||
}
|
||||
|
||||
if (request->headers()) {
|
||||
res += "headers:\n";
|
||||
for (size_t i = 0; i < request->headers(); i++) {
|
||||
AsyncWebHeader* h = request->getHeader(i);
|
||||
res += h->name();
|
||||
res += '=';
|
||||
res += h->value();
|
||||
res += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (request->params()) {
|
||||
res += "params:\n";
|
||||
for (size_t i = 0; i < request->params(); i++) {
|
||||
AsyncWebParameter* p = request->getParam(i);
|
||||
if (p->isFile()) {
|
||||
res += "FILE";
|
||||
} else if (p->isPost()) {
|
||||
res += "POST";
|
||||
} else {
|
||||
res += "GET";
|
||||
}
|
||||
res += ' ';
|
||||
res += p->name();
|
||||
res += ':';
|
||||
res += p->value();
|
||||
if (p->isFile()) {
|
||||
res += " size:";
|
||||
res += p->size();
|
||||
}
|
||||
res += '\n';
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user