mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 07:40:58 -08:00
Fix captive portal not showing after AP connect
This commit is contained in:
2
.github/workflows/build_push.yml
vendored
2
.github/workflows/build_push.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Install ESPAsyncWebServer
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: justcallmekoko/ESPAsyncWebServer
|
||||
repository: bigbrodude6119/ESPAsyncWebServer
|
||||
ref: master
|
||||
path: CustomESPAsyncWebServer
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ String EvilPortal::get_password() {
|
||||
|
||||
void EvilPortal::setupServer() {
|
||||
server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", this->index_html);
|
||||
request->send_P(200, "text/html", index_html);
|
||||
Serial.println("client connected");
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Client connected to server");
|
||||
@@ -90,7 +90,7 @@ bool EvilPortal::setHtml() {
|
||||
if (isPrintable(c))
|
||||
html.concat(c);
|
||||
}
|
||||
strncpy(this->index_html, html.c_str(), strlen(html.c_str()));
|
||||
strncpy(index_html, html.c_str(), strlen(html.c_str()));
|
||||
this->has_html = true;
|
||||
Serial.println("html set");
|
||||
html_file.close();
|
||||
@@ -203,7 +203,7 @@ bool EvilPortal::setAP(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_
|
||||
}
|
||||
|
||||
if (ap_config != "") {
|
||||
strncpy(this->apName, ap_config.c_str(), strlen(ap_config.c_str()));
|
||||
strncpy(apName, ap_config.c_str(), strlen(ap_config.c_str()));
|
||||
this->has_ap = true;
|
||||
Serial.println("ap config set");
|
||||
return true;
|
||||
@@ -215,10 +215,10 @@ bool EvilPortal::setAP(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_
|
||||
|
||||
void EvilPortal::startAP() {
|
||||
Serial.print("starting ap ");
|
||||
Serial.println(this->apName);
|
||||
Serial.println(apName);
|
||||
|
||||
WiFi.mode(WIFI_AP);
|
||||
WiFi.softAP(this->apName);
|
||||
WiFi.softAP(apName);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("AP started");
|
||||
|
||||
@@ -39,17 +39,8 @@ extern Buffer buffer_obj;
|
||||
#define MAX_AP_NAME_SIZE 30
|
||||
#define WIFI_SCAN_EVIL_PORTAL 30
|
||||
|
||||
class CaptiveRequestHandler : public AsyncWebHandler {
|
||||
public:
|
||||
CaptiveRequestHandler() {}
|
||||
virtual ~CaptiveRequestHandler() {}
|
||||
|
||||
bool canHandle(AsyncWebServerRequest *request) { return true; }
|
||||
|
||||
void handleRequest(AsyncWebServerRequest *request, char * index_html) {
|
||||
request->send_P(200, "text/html", index_html);
|
||||
}
|
||||
};
|
||||
char apName[MAX_AP_NAME_SIZE] = "PORTAL";
|
||||
char index_html[MAX_HTML_SIZE] = "TEST";
|
||||
|
||||
struct ssid {
|
||||
String essid;
|
||||
@@ -68,6 +59,18 @@ struct AccessPoint {
|
||||
LinkedList<int>* stations;
|
||||
};
|
||||
|
||||
class CaptiveRequestHandler : public AsyncWebHandler {
|
||||
public:
|
||||
CaptiveRequestHandler() {}
|
||||
virtual ~CaptiveRequestHandler() {}
|
||||
|
||||
bool canHandle(AsyncWebServerRequest *request) { return true; }
|
||||
|
||||
void handleRequest(AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", index_html);
|
||||
}
|
||||
};
|
||||
|
||||
class EvilPortal {
|
||||
|
||||
private:
|
||||
@@ -78,9 +81,6 @@ class EvilPortal {
|
||||
String user_name;
|
||||
String password;
|
||||
|
||||
char apName[MAX_AP_NAME_SIZE] = "PORTAL";
|
||||
char index_html[MAX_HTML_SIZE] = "TEST";
|
||||
|
||||
bool has_html;
|
||||
bool has_ap;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//#define XIAO_ESP32_S3
|
||||
//// END BOARD TARGETS
|
||||
|
||||
#define MARAUDER_VERSION "v0.11.0-RC1"
|
||||
#define MARAUDER_VERSION "v0.11.0-RC2"
|
||||
|
||||
//// BOARD FEATURES
|
||||
#ifdef MARAUDER_M5STICKC
|
||||
|
||||
Reference in New Issue
Block a user