diff --git a/README.md b/README.md
index a95a00f5e6..0d6ef91b77 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,6 @@ Also, [read our FAQ](https://wiki.bruce.computer/faq/)
- [x] [Target Atk](https://wiki.bruce.computer/features/wifi/#target-atks)
- [x] Information
- [x] Target Deauth
- - [x] EvilPortal + Deauth
- [x] Deauth Flood (More than one target)
- [x] [Wardriving](https://wiki.bruce.computer/features/gps/#wardriving)
- [x] [TelNet](https://wiki.bruce.computer/features/wifi/#telnet)
@@ -57,13 +56,11 @@ Also, [read our FAQ](https://wiki.bruce.computer/faq/)
- [x] [RAW Sniffer](https://wiki.bruce.computer/features/wifi/#raw-sniffer)
- [x] [TCP Client](https://wiki.bruce.computer/features/wifi/#client-tcp)
- [x] [TCP Listener](https://wiki.bruce.computer/features/wifi/#listen-tcp)
-- [x] [Evil Portal](https://wiki.bruce.computer/features/wifi/#evil-portal)
- [x] [Scan Hosts](https://wiki.bruce.computer/features/wifi/#scan-hosts) (with TCP Port scanning)
- [x] [Responder](https://wiki.bruce.computer/features/wifi/#responder)
- [x] [Arp Spoofing](https://wiki.bruce.computer/features/wifi/#arp-spoofing)
- [x] [Arp Poisoning](https://wiki.bruce.computer/features/wifi/#arp-poisoning)
- [x] [Wireguard Tunneling](https://wiki.bruce.computer/features/wifi/#wireguard-tunneling)
-- [x] Brucegotchi
- [x] Pwnagotchi friend
- [x] Pwngrid spam faces & names
- [x] [Optional] DoScreen a very long name and face
@@ -236,7 +233,7 @@ Also, [read our FAQ](https://wiki.bruce.computer/faq/)
² CYD have a LITE_VERSION version for Launcher Compatibility
¹ Core, CYD and StickCs Bad-USB: [here](https://wiki.bruce.computer/features/others/#badusb)
-_LITE_VERSION_: TelNet, SSH, WireGuard, ScanHosts, RawSniffer, Brucegotchi, BLEBacon, BLEScan and Interpreter are NOT available for M5Launcher Compatibility
+_LITE_VERSION_: TelNet, SSH, WireGuard, ScanHosts, RawSniffer, BLEBacon, BLEScan and Interpreter are NOT available for M5Launcher Compatibility
## :sparkles: Why and how does it look?
diff --git a/boards/lilygo-t-display-ttgo/interface.cpp b/boards/lilygo-t-display-ttgo/interface.cpp
index fc60e83899..9d1058c850 100644
--- a/boards/lilygo-t-display-ttgo/interface.cpp
+++ b/boards/lilygo-t-display-ttgo/interface.cpp
@@ -9,11 +9,11 @@ volatile bool prvPress = false;
volatile bool ecPress = false;
volatile bool slPress = false;
static void onButtonSingleClickCb1(void *button_handle, void *usr_data) { nxtPress = true; }
-static void onButtonDoubleClickCb1(void *button_handle, void *usr_data) { slPress = true; }
+//static void onButtonDoubleClickCb1(void *button_handle, void *usr_data) { slPress = true; }
static void onButtonHoldCb1(void *button_handle, void *usr_data) { slPress = true; }
static void onButtonSingleClickCb2(void *button_handle, void *usr_data) { prvPress = true; }
-static void onButtonDoubleClickCb2(void *button_handle, void *usr_data) { ecPress = true; }
+//static void onButtonDoubleClickCb2(void *button_handle, void *usr_data) { ecPress = true; }
static void onButtonHoldCb2(void *button_handle, void *usr_data) { ecPress = true; }
Button *btn1;
@@ -29,8 +29,8 @@ void _setup_gpio() {
pinMode(UP_BTN, INPUT_PULLUP);
button_config_t bt1 = {
.type = BUTTON_TYPE_GPIO,
- .long_press_time = 600,
- .short_press_time = 120,
+ .long_press_time = 250,
+ .short_press_time = 40,
.gpio_button_config = {
.gpio_num = DW_BTN,
.active_level = 0,
@@ -38,8 +38,8 @@ void _setup_gpio() {
};
button_config_t bt2 = {
.type = BUTTON_TYPE_GPIO,
- .long_press_time = 600,
- .short_press_time = 120,
+ .long_press_time = 250,
+ .short_press_time = 40,
.gpio_button_config = {
.gpio_num = UP_BTN,
.active_level = 0,
@@ -48,12 +48,12 @@ void _setup_gpio() {
btn1 = new Button(bt1);
btn1->attachSingleClickEventCb(&onButtonSingleClickCb1, NULL);
- btn1->attachDoubleClickEventCb(&onButtonDoubleClickCb1, NULL);
+ //btn1->attachDoubleClickEventCb(&onButtonDoubleClickCb1, NULL);
btn1->attachLongPressStartEventCb(&onButtonHoldCb1, NULL);
btn2 = new Button(bt2);
btn2->attachSingleClickEventCb(&onButtonSingleClickCb2, NULL);
- btn2->attachDoubleClickEventCb(&onButtonDoubleClickCb2, NULL);
+ //btn2->attachDoubleClickEventCb(&onButtonDoubleClickCb2, NULL);
btn2->attachLongPressStartEventCb(&onButtonHoldCb2, NULL);
// setup POWER pin required by the vendor
diff --git a/embedded_resources/web_interface/index.js b/embedded_resources/web_interface/index.js
index fd61602940..9e9f898595 100644
--- a/embedded_resources/web_interface/index.js
+++ b/embedded_resources/web_interface/index.js
@@ -867,7 +867,6 @@ async function renderTFT(data) {
const allText = screenText.join(" ").toLowerCase();
const isWiFiMenu =
allText.includes("wifi") ||
- allText.includes("evil portal") ||
allText.includes("deauth") ||
allText.includes("handshake");
diff --git a/include/globals.h b/include/globals.h
index 348ee78e2b..9499438c9c 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -11,7 +11,6 @@
#include "SerialDevice.h"
#include "core/USBSerial/USBSerial.h"
-#include "core/config.h"
#include "core/configPins.h"
#include "core/serial_commands/cli.h"
#include "core/startup_app.h"
diff --git a/sd_files/wifi/evil portal/readme.md b/sd_files/wifi/evil portal/readme.md
deleted file mode 100644
index e13902ee12..0000000000
--- a/sd_files/wifi/evil portal/readme.md
+++ /dev/null
@@ -1,50 +0,0 @@
-### **Setting AP Name from HTML**
-
-#### **Overview**
-The `EvilPortal` system now supports the ability to define an Access Point (AP) name directly within your HTML files. By including a specific tag in the first line of your HTML file, the system will automatically extract and set the AP name, streamlining the setup process.
-
----
-
-#### **How It Works**
-1. Add the following tag in the **first line** of your HTML file:
- ```html
-
- ```
- Replace `YourCustomAPName` with the desired name for your Access Point.
-
-2. When the HTML file is loaded, the system will:
- - Parse the first line of the file.
- - Detect the `AP="..."` tag.
- - Extract the value and set it as the AP name.
-
-3. If the tag is not present it will ask you for AP name (as usual).
-
----
-
-#### **Example HTML File**
-```html
-
-
-
-
- EvilPortal
-
-
- Welcome to EvilPortal!
-
-
-```
-
-- In this example, the AP name will automatically be set to **MyCoolNetwork**.
-
----
-
-#### **Benefits**
-- **Dynamic Configuration**: Easily customize AP names without modifying code.
-- **Ease of Use**: Set up AP names directly in your HTML files for faster deployment.
-
----
-
-#### **Notes**
-- Ensure the `` tag is in the **very first line** of the file.
-- The feature does not affect the functionality of other HTML content.
\ No newline at end of file
diff --git a/src/core/config.cpp b/src/core/config.cpp
deleted file mode 100644
index 3a0b4b132f..0000000000
--- a/src/core/config.cpp
+++ /dev/null
@@ -1,883 +0,0 @@
-#include "config.h"
-#include "mifare_keys_manager.h"
-#include "sd_functions.h"
-
-JsonDocument BruceConfig::toJson() const {
- JsonDocument jsonDoc;
- JsonObject setting = jsonDoc.to();
-
- setting["priColor"] = String(priColor, HEX);
- setting["secColor"] = String(secColor, HEX);
- setting["bgColor"] = String(bgColor, HEX);
- setting["themeFile"] = themePath;
- setting["themeOnSd"] = theme.fs;
-
- setting["dimmerSet"] = dimmerSet;
- setting["bright"] = bright;
- setting["automaticTimeUpdateViaNTP"] = automaticTimeUpdateViaNTP;
- setting["tmz"] = tmz;
- setting["dst"] = dst;
- setting["clock24hr"] = clock24hr;
- setting["soundEnabled"] = soundEnabled;
- setting["soundVolume"] = soundVolume;
- setting["wifiAtStartup"] = wifiAtStartup;
- setting["instantBoot"] = instantBoot;
- setting["keyboardLang"] = keyboardLang;
-
-#ifdef HAS_RGB_LED
- setting["ledBright"] = ledBright;
- setting["ledColor"] = String(ledColor, HEX);
- setting["ledBlinkEnabled"] = ledBlinkEnabled;
- setting["ledEffect"] = ledEffect;
- setting["ledEffectSpeed"] = ledEffectSpeed;
- setting["ledEffectDirection"] = ledEffectDirection;
-#endif
-
- JsonObject _webUI = setting["webUI"].to();
- _webUI["user"] = webUI.user;
- _webUI["pwd"] = webUI.pwd;
- JsonObject _webUISessions = setting["webUISessions"].to();
- for (size_t i = 0; i < webUISessions.size(); i++) { _webUISessions[String(i + 1)] = webUISessions[i]; }
-
- JsonObject _wifiAp = setting["wifiAp"].to();
- _wifiAp["ssid"] = wifiAp.ssid;
- _wifiAp["pwd"] = wifiAp.pwd;
- setting["wifiMAC"] = wifiMAC; //@IncursioHack
- setting["TerminalLog"] = TerminalLog;
-
- JsonArray _evilWifiNames = setting["evilWifiNames"].to();
- for (auto key : evilWifiNames) _evilWifiNames.add(key);
-
- JsonObject _evilWifiEndpoints = setting["evilWifiEndpoints"].to();
- _evilWifiEndpoints["getCredsEndpoint"] = evilPortalEndpoints.getCredsEndpoint;
- _evilWifiEndpoints["setSsidEndpoint"] = evilPortalEndpoints.setSsidEndpoint;
- _evilWifiEndpoints["showEndpoints"] = evilPortalEndpoints.showEndpoints;
- _evilWifiEndpoints["allowSetSsid"] = evilPortalEndpoints.allowSetSsid;
- _evilWifiEndpoints["allowGetCreds"] = evilPortalEndpoints.allowGetCreds;
- _evilWifiEndpoints["gatewayIp"] = evilPortalGatewayIp;
-
- setting["evilWifiPasswordMode"] = evilPortalPasswordMode;
-
- JsonObject _wifi = setting["wifi"].to();
- for (const auto &pair : wifi) { _wifi[pair.first] = pair.second; }
-
- setting["startupApp"] = startupApp;
- setting["startupAppJSInterpreterFile"] = startupAppJSInterpreterFile;
- setting["wigleBasicToken"] = wigleBasicToken;
- setting["wdgwarsApiKey"] = wdgwarsApiKey;
- setting["devMode"] = devMode;
- setting["colorInverted"] = colorInverted;
-
- setting["badUSBBLEKeyboardLayout"] = badUSBBLEKeyboardLayout;
- setting["badUSBBLEKeyDelay"] = badUSBBLEKeyDelay;
- setting["badUSBBLEShowOutput"] = badUSBBLEShowOutput;
-
- JsonArray dm = setting["disabledMenus"].to();
- for (int i = 0; i < disabledMenus.size(); i++) { dm.add(disabledMenus[i]); }
-
- JsonArray qrArray = setting["qrCodes"].to();
- for (const auto &entry : qrCodes) {
- JsonObject qrEntry = qrArray.add();
- qrEntry["menuName"] = entry.menuName;
- qrEntry["content"] = entry.content;
- }
-
- return jsonDoc;
-}
-
-void BruceConfig::fromFile(bool checkFS) {
- FS *fs;
- if (checkFS) {
- if (!getFsStorage(fs)) {
- log_i("Fail getting filesystem for config");
- return;
- }
- } else {
- if (checkLittleFsSize()) fs = &LittleFS;
- else return;
- }
-
- if (!fs->exists(filepath)) {
- log_i("Config file not found. Creating default config");
- return saveFile();
- }
-
- File file;
- file = fs->open(filepath, FILE_READ);
- if (!file) {
- log_i("Config file not found. Using default values");
- return;
- }
-
- // Deserialize the JSON document
- JsonDocument jsonDoc;
- if (deserializeJson(jsonDoc, file)) {
- Serial.println("Failed to read config file, using default configuration");
- return;
- }
- file.close();
-
- JsonObject setting = jsonDoc.as();
- int count = 0;
-
- if (!setting["priColor"].isNull()) {
- priColor = strtoul(setting["priColor"], nullptr, 16);
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["secColor"].isNull()) {
- secColor = strtoul(setting["secColor"], nullptr, 16);
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["bgColor"].isNull()) {
- bgColor = strtoul(setting["bgColor"], nullptr, 16);
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["themeFile"].isNull()) {
- themePath = setting["themeFile"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["themeOnSd"].isNull()) {
- theme.fs = setting["themeOnSd"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["dimmerSet"].isNull()) {
- dimmerSet = setting["dimmerSet"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["bright"].isNull()) {
- bright = setting["bright"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["automaticTimeUpdateViaNTP"].isNull()) {
- automaticTimeUpdateViaNTP = setting["automaticTimeUpdateViaNTP"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["tmz"].isNull()) {
- tmz = setting["tmz"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["dst"].isNull()) {
- dst = setting["dst"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["clock24hr"].isNull()) {
- clock24hr = setting["clock24hr"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["soundEnabled"].isNull()) {
- soundEnabled = setting["soundEnabled"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["soundVolume"].isNull()) {
- soundVolume = setting["soundVolume"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["wifiAtStartup"].isNull()) {
- wifiAtStartup = setting["wifiAtStartup"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["instantBoot"].isNull()) {
- instantBoot = setting["instantBoot"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["keyboardLang"].isNull()) {
- keyboardLang = setting["keyboardLang"].as();
- } else {
- keyboardLang = "QWERTY";
- }
-
-#ifdef HAS_RGB_LED
- if (!setting["ledBright"].isNull()) {
- ledBright = setting["ledBright"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["ledColor"].isNull()) {
- ledColor = strtoul(setting["ledColor"], nullptr, 16);
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["ledBlinkEnabled"].isNull()) {
- ledBlinkEnabled = setting["ledBlinkEnabled"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["ledEffect"].isNull()) {
- ledEffect = setting["ledEffect"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["ledEffectSpeed"].isNull()) {
- ledEffectSpeed = setting["ledEffectSpeed"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["ledEffectDirection"].isNull()) {
- ledEffectDirection = setting["ledEffectDirection"].as();
- } else {
- count++;
- log_e("Fail");
- }
-#endif
-
- if (!setting["webUI"].isNull()) {
- JsonObject webUIObj = setting["webUI"].as();
- webUI.user = webUIObj["user"].as();
- webUI.pwd = webUIObj["pwd"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["webUISessions"].isNull()) {
- webUISessions.clear();
- JsonObject webUISessionsObj = setting["webUISessions"].as();
- for (JsonPair kv : webUISessionsObj) { webUISessions.push_back(kv.value().as()); }
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["wifiAp"].isNull()) {
- JsonObject wifiApObj = setting["wifiAp"].as();
- wifiAp.ssid = wifiApObj["ssid"].as();
- wifiAp.pwd = wifiApObj["pwd"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- //@IncursioHack
- if (!setting["wifiMAC"].isNull()) {
- wifiMAC = setting["wifiMAC"].as();
- } else {
- wifiMAC = "";
- count++;
- log_e("wifiMAC not found, using default");
- }
- if (!setting["TerminalLog"].isNull()) {
- TerminalLog = setting["TerminalLog"].as();
- } else {
- count++;
- log_e("TerminalLog not found, using default");
- }
-
- // Wifi List
- if (!setting["wifi"].isNull()) {
- wifi.clear();
- JsonObject wifiObj = setting["wifi"].as();
- for (JsonPair kv : wifiObj) wifi[kv.key().c_str()] = kv.value().as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["evilWifiNames"].isNull()) {
- evilWifiNames.clear();
- JsonArray _evilWifiNames = setting["evilWifiNames"].as();
- for (JsonVariant key : _evilWifiNames) evilWifiNames.insert(key.as());
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["evilWifiEndpoints"].isNull()) {
- JsonObject evilPortalEndpointsObj = setting["evilWifiEndpoints"].as();
- evilPortalEndpoints.getCredsEndpoint = evilPortalEndpointsObj["getCredsEndpoint"].as();
- evilPortalEndpoints.setSsidEndpoint = evilPortalEndpointsObj["setSsidEndpoint"].as();
- evilPortalEndpoints.showEndpoints = evilPortalEndpointsObj["showEndpoints"].as();
- evilPortalEndpoints.allowSetSsid = evilPortalEndpointsObj["allowSetSsid"].as();
- evilPortalEndpoints.allowGetCreds = evilPortalEndpointsObj["allowGetCreds"].as();
- if (!evilPortalEndpointsObj["gatewayIp"].isNull()) {
- evilPortalGatewayIp = evilPortalEndpointsObj["gatewayIp"].as();
- } else {
- evilPortalGatewayIp = "172.0.0.1";
- }
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["evilWifiPasswordMode"].isNull()) {
- int mode = setting["evilWifiPasswordMode"].as();
- if (mode >= 0 && mode <= 2) {
- evilPortalPasswordMode = static_cast(mode);
- } else {
- evilPortalPasswordMode = FULL_PASSWORD;
- log_w("Invalid evilWifiPasswordMode, using FULL_PASSWORD");
- }
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["startupApp"].isNull()) {
- startupApp = setting["startupApp"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["startupAppJSInterpreterFile"].isNull()) {
- startupAppJSInterpreterFile = setting["startupAppJSInterpreterFile"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["wigleBasicToken"].isNull()) {
- wigleBasicToken = setting["wigleBasicToken"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["wdgwarsApiKey"].isNull()) {
- wdgwarsApiKey = setting["wdgwarsApiKey"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["devMode"].isNull()) {
- devMode = setting["devMode"].as();
- } else {
- count++;
- log_e("Fail");
- }
- if (!setting["colorInverted"].isNull()) {
- colorInverted = setting["colorInverted"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["badUSBBLEKeyboardLayout"].isNull()) {
- badUSBBLEKeyboardLayout = setting["badUSBBLEKeyboardLayout"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["badUSBBLEKeyDelay"].isNull()) {
- badUSBBLEKeyDelay = setting["badUSBBLEKeyDelay"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["badUSBBLEShowOutput"].isNull()) {
- badUSBBLEShowOutput = setting["badUSBBLEShowOutput"].as();
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["disabledMenus"].isNull()) {
- disabledMenus.clear();
- JsonArray dm = setting["disabledMenus"].as();
- for (JsonVariant e : dm) { disabledMenus.push_back(e.as()); }
- } else {
- count++;
- log_e("Fail");
- }
-
- if (!setting["qrCodes"].isNull()) {
- qrCodes.clear();
- JsonArray qrArray = setting["qrCodes"].as();
- for (JsonObject qrEntry : qrArray) {
- String menuName = qrEntry["menuName"].as();
- String content = qrEntry["content"].as();
- qrCodes.push_back({menuName, content});
- }
- } else {
- count++;
- log_e("Fail to load qrCodes");
- }
-
- validateConfig();
- if (count > 0) saveFile();
-
- // Load MIFARE keys (loading via manager)
- MifareKeysManager::ensureLoaded(mifareKeys);
-
- log_i("Using config from file");
-}
-
-void BruceConfig::saveFile() {
- FS *fs = &LittleFS;
- JsonDocument jsonDoc = toJson();
-
- // Open file for writing
- File file = fs->open(filepath, FILE_WRITE);
- if (!file) {
- log_e("Failed to open config file");
- file.close();
- return;
- };
-
- // Serialize JSON to file
- serializeJsonPretty(jsonDoc, Serial);
- if (serializeJsonPretty(jsonDoc, file) < 5) log_e("Failed to write config file");
- else log_i("config file written successfully");
-
- file.close();
-
- if (setupSdCard()) copyToFs(LittleFS, SD, filepath, false);
-}
-
-void BruceConfig::factoryReset() {
- FS *fs = &LittleFS;
- fs->rename(String(filepath), "/bak." + String(filepath).substring(1));
- if (setupSdCard()) SD.rename(String(filepath), "/bak." + String(filepath).substring(1));
- ESP.restart();
-}
-
-void BruceConfig::validateConfig() {
- validateDimmerValue();
- validateBrightValue();
- validateTmzValue();
- validateSoundEnabledValue();
- validateSoundVolumeValue();
- validateWifiAtStartupValue();
-#ifdef HAS_RGB_LED
- validateLedBrightValue();
- validateLedColorValue();
- validateLedBlinkEnabledValue();
- validateLedEffectValue();
- validateLedEffectSpeedValue();
- validateLedEffectDirectionValue();
-#endif
- validateMifareKeysItems();
- validateDevModeValue();
- validateColorInverted();
- validateBadUSBBLEKeyboardLayout();
- validateBadUSBBLEKeyDelay();
- validateEvilEndpointCreds();
- validateEvilEndpointSsid();
- validateEvilPasswordMode();
- validateEvilGatewayIp();
-}
-
-void BruceConfig::setUiColor(uint16_t primary, uint16_t *secondary, uint16_t *background) {
- BruceTheme::_setUiColor(primary, secondary, background);
- saveFile();
-}
-
-void BruceConfig::setDimmer(int value) {
- dimmerSet = value;
- validateDimmerValue();
- saveFile();
-}
-
-void BruceConfig::validateDimmerValue() {
- if (dimmerSet < 0) dimmerSet = 10;
- if (dimmerSet > 60) dimmerSet = 0;
-}
-
-void BruceConfig::setBright(uint8_t value) {
- bright = value;
- validateBrightValue();
- saveFile();
-}
-
-void BruceConfig::validateBrightValue() {
- if (bright > 100) bright = 100;
-}
-
-void BruceConfig::setAutomaticTimeUpdateViaNTP(bool value) {
- automaticTimeUpdateViaNTP = value;
- saveFile();
-}
-
-void BruceConfig::setTmz(float value) {
- tmz = value;
- validateTmzValue();
- saveFile();
-}
-
-void BruceConfig::validateTmzValue() {
- if (tmz < -12 || tmz > 14) tmz = 0;
-}
-
-void BruceConfig::setDST(bool value) {
- dst = value;
- saveFile();
-}
-
-void BruceConfig::setClock24Hr(bool value) {
- clock24hr = value;
- saveFile();
-}
-
-void BruceConfig::setSoundEnabled(int value) {
- soundEnabled = value;
- validateSoundEnabledValue();
- saveFile();
-}
-
-void BruceConfig::setSoundVolume(int value) {
- soundVolume = value;
- validateSoundVolumeValue();
- saveFile();
-}
-
-void BruceConfig::validateSoundEnabledValue() {
- if (soundEnabled > 1) soundEnabled = 1;
-}
-
-void BruceConfig::validateSoundVolumeValue() {
- if (soundVolume > 100) soundVolume = 100;
-}
-
-void BruceConfig::setWifiAtStartup(int value) {
- wifiAtStartup = value;
- validateWifiAtStartupValue();
- saveFile();
-}
-
-void BruceConfig::validateWifiAtStartupValue() {
- if (wifiAtStartup > 1) wifiAtStartup = 1;
-}
-
-#ifdef HAS_RGB_LED
-void BruceConfig::setLedBright(int value) {
- ledBright = value;
- validateLedBrightValue();
- saveFile();
-}
-
-void BruceConfig::validateLedBrightValue() { ledBright = max(0, min(100, ledBright)); }
-
-void BruceConfig::setLedColor(uint32_t value) {
- ledColor = value;
- validateLedColorValue();
- saveFile();
-}
-
-void BruceConfig::validateLedColorValue() {
- ledColor = max(0, min(0xFFFFFFFF, ledColor));
-}
-
-void BruceConfig::setLedBlinkEnabled(int value) {
- ledBlinkEnabled = value;
- validateLedBlinkEnabledValue();
- saveFile();
-}
-
-void BruceConfig::validateLedBlinkEnabledValue() {
- if (ledBlinkEnabled > 1) ledBlinkEnabled = 1;
-}
-
-void BruceConfig::setLedEffect(int value) {
- ledEffect = value;
- validateLedEffectValue();
- saveFile();
-}
-
-void BruceConfig::validateLedEffectValue() {
- if (ledEffect < 0 || ledEffect > 9) ledEffect = 0;
-}
-
-void BruceConfig::setLedEffectSpeed(int value) {
- ledEffectSpeed = value;
- validateLedEffectSpeedValue();
- saveFile();
-}
-
-void BruceConfig::validateLedEffectSpeedValue() {
-#ifdef HAS_ENCODER_LED
- if (ledEffectSpeed > 11) ledEffectSpeed = 11;
-#else
- if (ledEffectSpeed > 10) ledEffectSpeed = 10;
-#endif
- if (ledEffectSpeed < 0) ledEffectSpeed = 1;
-}
-
-void BruceConfig::setLedEffectDirection(int value) {
- ledEffectDirection = value;
- validateLedEffectDirectionValue();
- saveFile();
-}
-
-void BruceConfig::validateLedEffectDirectionValue() {
- if (ledEffectDirection > 1 || ledEffectDirection == 0) ledEffectDirection = 1;
- if (ledEffectDirection < -1) ledEffectDirection = -1;
-}
-#endif
-
-void BruceConfig::setWebUICreds(const String &usr, const String &pwd) {
- webUI.user = usr;
- webUI.pwd = pwd;
- saveFile();
-}
-
-void BruceConfig::setWifiApCreds(const String &ssid, const String &pwd) {
- wifiAp.ssid = ssid;
- wifiAp.pwd = pwd;
- saveFile();
-}
-
-void BruceConfig::setTerminalLog(bool value) {
- TerminalLog = value;
- saveFile();
-}
-
-void BruceConfig::addWifiCredential(const String &ssid, const String &pwd) {
- wifi[ssid] = pwd;
- saveFile();
-}
-
-String BruceConfig::getWifiPassword(const String &ssid) const {
- auto it = wifi.find(ssid);
- if (it != wifi.end()) return it->second;
- return "";
-}
-
-void BruceConfig::addEvilWifiName(String value) {
- evilWifiNames.insert(value);
- saveFile();
-}
-
-void BruceConfig::removeEvilWifiName(String value) {
- evilWifiNames.erase(value);
- saveFile();
-}
-
-void BruceConfig::setEvilEndpointCreds(String value) {
- evilPortalEndpoints.getCredsEndpoint = value;
- validateEvilEndpointCreds();
- saveFile();
-}
-
-void BruceConfig::validateEvilEndpointCreds() {
- if (evilPortalEndpoints.getCredsEndpoint == evilPortalEndpoints.setSsidEndpoint) {
- // on collision reset to defaults
- evilPortalEndpoints.getCredsEndpoint = "/creds";
- }
- if (evilPortalEndpoints.getCredsEndpoint[0] != '/') {
- evilPortalEndpoints.getCredsEndpoint = '/' + evilPortalEndpoints.getCredsEndpoint;
- }
-}
-
-void BruceConfig::setEvilEndpointSsid(String value) {
- evilPortalEndpoints.setSsidEndpoint = value;
- validateEvilEndpointCreds();
- saveFile();
-}
-
-void BruceConfig::validateEvilEndpointSsid() {
- if (evilPortalEndpoints.getCredsEndpoint == evilPortalEndpoints.setSsidEndpoint) {
- // on collision reset to defaults
- evilPortalEndpoints.setSsidEndpoint = "/ssid";
- }
- if (evilPortalEndpoints.setSsidEndpoint[0] != '/') {
- evilPortalEndpoints.setSsidEndpoint = '/' + evilPortalEndpoints.setSsidEndpoint;
- }
-}
-
-void BruceConfig::setEvilAllowEndpointDisplay(bool value) {
- evilPortalEndpoints.showEndpoints = value;
- saveFile();
-}
-
-void BruceConfig::setEvilAllowGetCreds(bool value) {
- evilPortalEndpoints.allowGetCreds = value;
- saveFile();
-}
-
-void BruceConfig::setEvilAllowSetSsid(bool value) {
- evilPortalEndpoints.allowSetSsid = value;
- saveFile();
-}
-
-void BruceConfig::setEvilPasswordMode(EvilPortalPasswordMode value) {
- evilPortalPasswordMode = value;
- saveFile();
-}
-
-void BruceConfig::validateEvilPasswordMode() {
- if (evilPortalPasswordMode < 0 || evilPortalPasswordMode > 2) evilPortalPasswordMode = FULL_PASSWORD;
-}
-
-void BruceConfig::setEvilGatewayIp(String value) {
- evilPortalGatewayIp = value;
- validateEvilGatewayIp();
- saveFile();
-}
-
-void BruceConfig::validateEvilGatewayIp() {
- IPAddress gatewayIp;
- if (!gatewayIp.fromString(evilPortalGatewayIp)) evilPortalGatewayIp = "172.0.0.1";
-}
-
-void BruceConfig::setStartupApp(String value) {
- startupApp = value;
- saveFile();
-}
-
-void BruceConfig::setStartupAppJSInterpreterFile(String value) {
- startupAppJSInterpreterFile = value;
- saveFile();
-}
-
-void BruceConfig::setWigleBasicToken(String value) {
- wigleBasicToken = value;
- saveFile();
-}
-
-void BruceConfig::setWdgwarsApiKey(String value) {
- wdgwarsApiKey = value;
- saveFile();
-}
-
-void BruceConfig::setDevMode(int value) {
- devMode = value;
- validateDevModeValue();
- saveFile();
-}
-
-void BruceConfig::validateDevModeValue() {
- if (devMode > 1) devMode = 1;
-}
-
-void BruceConfig::setColorInverted(int value) {
- colorInverted = value;
- validateColorInverted();
- saveFile();
-}
-
-void BruceConfig::validateColorInverted() {
- if (colorInverted > 1) colorInverted = 1;
-}
-
-void BruceConfig::setBadUSBBLEKeyboardLayout(int value) {
- badUSBBLEKeyboardLayout = value;
- validateBadUSBBLEKeyboardLayout();
- saveFile();
-}
-
-void BruceConfig::validateBadUSBBLEKeyboardLayout() {
- if (badUSBBLEKeyboardLayout < 0 || badUSBBLEKeyboardLayout > 13) badUSBBLEKeyboardLayout = 0;
-}
-
-void BruceConfig::setBadUSBBLEKeyDelay(uint16_t value) {
- badUSBBLEKeyDelay = value;
- validateBadUSBBLEKeyDelay();
- saveFile();
-}
-
-void BruceConfig::validateBadUSBBLEKeyDelay() {
- if (badUSBBLEKeyDelay < 0) badUSBBLEKeyDelay = 0;
- if (badUSBBLEKeyDelay > 500) badUSBBLEKeyDelay = 500;
-}
-
-void BruceConfig::setBadUSBBLEShowOutput(bool value) {
- badUSBBLEShowOutput = value;
- saveFile();
-}
-void BruceConfig::addMifareKey(String value) { MifareKeysManager::addKey(mifareKeys, value); }
-
-void BruceConfig::validateMifareKeysItems() { MifareKeysManager::validateKeys(mifareKeys); }
-
-void BruceConfig::addDisabledMenu(String value) {
- // TODO: check if duplicate
- disabledMenus.push_back(value);
- saveFile();
-}
-
-void BruceConfig::addQrCodeEntry(const String &menuName, const String &content) {
- qrCodes.push_back({menuName, content});
- saveFile();
-}
-
-void BruceConfig::removeQrCodeEntry(const String &menuName) {
- size_t writeIndex = 0;
-
- for (size_t readIndex = 0; readIndex < qrCodes.size(); ++readIndex) {
- const QrCodeEntry &entry = qrCodes[readIndex];
-
- if (entry.menuName != menuName) {
- if (writeIndex != readIndex) { qrCodes[writeIndex] = std::move(qrCodes[readIndex]); }
- ++writeIndex;
- }
- }
-
- if (writeIndex < qrCodes.size()) { qrCodes.erase(qrCodes.begin() + writeIndex, qrCodes.end()); }
-
- saveFile();
-}
-
-void BruceConfig::addWebUISession(const String &token) {
- webUISessions.push_back(token);
- // Limit to maximum 5 sessions - remove oldest (first element) if exceeded
- if (webUISessions.size() > 5) { webUISessions.erase(webUISessions.begin()); }
- saveFile();
-}
-
-void BruceConfig::removeWebUISession(const String &token) {
- for (auto it = webUISessions.begin(); it != webUISessions.end(); ++it) {
- if (*it == token) {
- webUISessions.erase(it);
- break;
- }
- }
- saveFile();
-}
-
-bool BruceConfig::isValidWebUISession(const String &token) {
- auto it = std::find(webUISessions.begin(), webUISessions.end(), token);
-
- if (it == webUISessions.end()) {
- return false; // Token not found
- }
-
- // Check if token is already at the end (most recent position)
- if (it == webUISessions.end() - 1) {
- return true; // Already most recent, no changes needed
- }
-
- // Move token to end and save
- webUISessions.erase(it);
- webUISessions.push_back(token);
-
- // Limit to maximum 10 sessions
- if (webUISessions.size() > 10) { webUISessions.erase(webUISessions.begin()); }
-
- saveFile();
- return true;
-}
diff --git a/src/core/config.h b/src/core/config.h
deleted file mode 100644
index 786c088d3f..0000000000
--- a/src/core/config.h
+++ /dev/null
@@ -1,202 +0,0 @@
-#ifndef __BRUCE_CONFIG_H__
-#define __BRUCE_CONFIG_H__
-
-#include "theme.h"
-#include
-#include
-#include