Merge pull request #235 from MartinMueller2003/master

Exposed  WebServer, Added password support.
This commit is contained in:
Lukas Bachschwell 2023-05-13 15:55:39 +02:00 committed by GitHub
commit 678a2ccf53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -206,6 +206,7 @@ public:
void jsonDom(uint16_t startidx, AsyncWebSocketClient* client = nullptr, bool Updating = false); void jsonDom(uint16_t startidx, AsyncWebSocketClient* client = nullptr, bool Updating = false);
Verbosity verbosity; Verbosity verbosity;
AsyncWebServer* server;
protected: protected:
friend class ESPUIclient; friend class ESPUIclient;
@ -217,7 +218,6 @@ protected:
void RemoveToBeDeletedControls(); void RemoveToBeDeletedControls();
AsyncWebServer* server;
AsyncWebSocket* ws; AsyncWebSocket* ws;
const char* basicAuthUsername = nullptr; const char* basicAuthUsername = nullptr;

View File

@ -59,16 +59,17 @@ void Control::DeleteControl()
void Control::MarshalControl(JsonObject & item, bool refresh) void Control::MarshalControl(JsonObject & item, bool refresh)
{ {
item[F("id")] = id; item[F("id")] = id;
ControlType TempType = (ControlType::Password == type) ? ControlType::Text : type;
if(refresh) if(refresh)
{ {
item[F("type")] = uint32_t(type) + uint32_t(ControlType::UpdateOffset); item[F("type")] = uint32_t(TempType) + uint32_t(ControlType::UpdateOffset);
} }
else else
{ {
item[F("type")] = uint32_t(type); item[F("type")] = uint32_t(TempType);
} }
item[F("label")] = label; item[F("label")] = label;
item[F("value")] = value; item[F ("value")] = (ControlType::Password == type) ? F ("--------") : value;
item[F("visible")] = visible; item[F("visible")] = visible;
item[F("color")] = (int)color; item[F("color")] = (int)color;
item[F("enabled")] = enabled; item[F("enabled")] = enabled;

View File

@ -30,6 +30,7 @@ enum ControlType : uint8_t
Separator, Separator,
Time, Time,
Password = 99,
UpdateOffset = 100, UpdateOffset = 100,
}; };