43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <HTTPRequest.hpp>
|
|
#include <HTTPResponse.hpp>
|
|
#include <HTTPServer.hpp>
|
|
|
|
#include "ChallengeResponse.h"
|
|
|
|
class Fader;
|
|
|
|
class WebServer
|
|
{
|
|
public:
|
|
bool start(void);
|
|
|
|
void setFader(Fader *fader) { m_fader = fader;}
|
|
|
|
static WebServer &instance(void)
|
|
{
|
|
static WebServer theInstance;
|
|
return theInstance;
|
|
}
|
|
|
|
private:
|
|
httpsserver::HTTPServer *m_server;
|
|
ChallengeResponse m_cr;
|
|
|
|
Fader *m_fader;
|
|
|
|
WebServer(void);
|
|
|
|
static void serverTask(void *arg);
|
|
|
|
static void serveFile(String filename, httpsserver::HTTPResponse *res);
|
|
|
|
// handlers
|
|
static void handleRoot(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
static void handleColor(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
static void handleChallenge(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
static void handleAuthTest(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
static void handleUpdate(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
static void handle404(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
|
}; |