forked from ct-Open-Source/Basecamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaptiveRequestHandler.hpp
More file actions
30 lines (28 loc) · 882 Bytes
/
Copy pathCaptiveRequestHandler.hpp
File metadata and controls
30 lines (28 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef CaptiveRequestHandler_h
#define CaptiveRequestHandler_h
class CaptiveRequestHandler : public AsyncWebHandler {
public:
CaptiveRequestHandler() {
}
virtual ~CaptiveRequestHandler() {
}
bool canHandle(AsyncWebServerRequest *request) {
//skip all basecamp related sources - handle all other requests and return the default html
if (request->url() != "/basecamp.css" &&
request->url() != "/basecamp.js" &&
request->url() != "/data.json" &&
request->url() != "/logo.svg" &&
request->url() != "/submitconfig") {
return true;
} else {
return false;
}
}
void handleRequest(AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse_P(
200, "text/html", index_htm_gz, index_htm_gz_len);
response->addHeader("Content-Encoding", "gzip");
request->send(response);
}
};
#endif