mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-22 19:20:59 +00:00
Add onCreateServerCallback hook
This commit is contained in:
parent
31911b3969
commit
656dab6e6a
@ -1436,6 +1436,10 @@ void ESPUIClass::begin(const char* _title, const char* username, const char* pas
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (onCreateServerCallback) {
|
||||||
|
onCreateServerCallback(server);
|
||||||
|
}
|
||||||
|
|
||||||
server->begin();
|
server->begin();
|
||||||
|
|
||||||
#if defined(DEBUG_ESPUI)
|
#if defined(DEBUG_ESPUI)
|
||||||
|
11
src/ESPUI.h
11
src/ESPUI.h
@ -28,9 +28,7 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <ArduinoOTA.h>
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266mDNS.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
#include <ESPAsyncTCP.h>
|
||||||
#include <Hash.h>
|
#include <Hash.h>
|
||||||
|
|
||||||
@ -108,6 +106,13 @@ public:
|
|||||||
bool auto_update_values = false;
|
bool auto_update_values = false;
|
||||||
|
|
||||||
void setVerbosity(Verbosity verbosity);
|
void setVerbosity(Verbosity verbosity);
|
||||||
|
|
||||||
|
typedef std::function<void(AsyncWebServer*)> onCreateServerCallback_t;
|
||||||
|
void onCreateServerCallbackSet(onCreateServerCallback_t callback)
|
||||||
|
{
|
||||||
|
onCreateServerCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
void begin(const char* _title, const char* username = nullptr, const char* password = nullptr,
|
void begin(const char* _title, const char* username = nullptr, const char* password = nullptr,
|
||||||
uint16_t port = 80); // Setup server and page in Memorymode
|
uint16_t port = 80); // Setup server and page in Memorymode
|
||||||
void beginSPIFFS(const char* _title, const char* username = nullptr, const char* password = nullptr,
|
void beginSPIFFS(const char* _title, const char* username = nullptr, const char* password = nullptr,
|
||||||
@ -246,6 +251,8 @@ protected:
|
|||||||
AsyncWebServer* server;
|
AsyncWebServer* server;
|
||||||
AsyncWebSocket* ws;
|
AsyncWebSocket* ws;
|
||||||
|
|
||||||
|
|
||||||
|
onCreateServerCallback_t onCreateServerCallback = nullptr;
|
||||||
const char* basicAuthUsername = nullptr;
|
const char* basicAuthUsername = nullptr;
|
||||||
const char* basicAuthPassword = nullptr;
|
const char* basicAuthPassword = nullptr;
|
||||||
bool basicAuth = true;
|
bool basicAuth = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user