Skip to content

Commit 8c289ba

Browse files
author
Spacehuhn
committed
Fixed issue with LittleFS (webSpiffs) setup
1 parent 4e7264b commit 8c289ba

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

esp8266_deauther/esp8266_deauther.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ void setup() {
117117
displayUI.mode = DISPLAY_MODE::INTRO;
118118
}
119119

120-
// copy web files to SPIFFS
121-
// copyWebFiles(false);
122-
123120
// load everything else
124121
names.load();
125122
ssids.load();

esp8266_deauther/wifi.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ namespace wifi {
196196
setHidden(settings::getAccessPointSettings().hidden);
197197
setCaptivePortal(settings::getWebSettings().captive_portal);
198198

199+
// copy web files to SPIFFS
200+
if (settings::getWebSettings().use_spiffs) {
201+
copyWebFiles(false);
202+
}
203+
199204
// Set mode
200205
mode = wifi_mode_t::off;
201206
WiFi.mode(WIFI_OFF);
@@ -404,6 +409,11 @@ namespace wifi {
404409
// ================================================================
405410
#endif /* ifdef USE_PROGMEM_WEB_FILES */
406411

412+
// aggressively caching static assets
413+
if (settings::getWebSettings().use_spiffs) {
414+
server.serveStatic("/", LittleFS, String(ap_settings.path).c_str(), "max-age=86400");
415+
}
416+
407417
server.on("/run", HTTP_GET, []() {
408418
server.send(200, str(W_TXT), str(W_OK).c_str());
409419
String input = server.arg("cmd");
@@ -414,9 +424,6 @@ namespace wifi {
414424
server.send(200, str(W_JSON), attack.getStatusJSON());
415425
});
416426

417-
// aggressively caching static assets
418-
server.serveStatic("/js", LittleFS, String(String(ap_settings.path) + "/js").c_str(), "max-age=86400");
419-
420427
// called when the url is not defined here
421428
// use it to load content from SPIFFS
422429
server.onNotFound([]() {

0 commit comments

Comments
 (0)