From b4474e504d38d65f2fc01affcf8599b1cbab0799 Mon Sep 17 00:00:00 2001 From: No-Signal Date: Sun, 22 Dec 2024 10:46:54 +0000 Subject: [PATCH] Moving additional sensitive settings to USER_SECRETS.h --- Software/USER_SECRETS.TEMPLATE.h | 11 ++++++++--- Software/USER_SETTINGS.h | 3 --- Software/src/devboard/webserver/webserver.cpp | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Software/USER_SECRETS.TEMPLATE.h b/Software/USER_SECRETS.TEMPLATE.h index eaf5ced1..1d1b0569 100644 --- a/Software/USER_SECRETS.TEMPLATE.h +++ b/Software/USER_SECRETS.TEMPLATE.h @@ -1,8 +1,13 @@ #define WIFI_SSID "REPLACE_WITH_YOUR_SSID" // Maximum of 63 characters #define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD" // Minimum of 8 characters -#define AP_PASSWORD "123456789" // Minimum of 8 characters; set to blank if you want the access point to be open -#define HTTP_USERNAME "admin" // username to webserver authentication; -#define HTTP_PASSWORD "admin" // password to webserver authentication; +#define AP_PASSWORD "123456789" // Minimum of 8 characters; set to blank if you want the access point to be open + +#define WEBSERVER_AUTH_REQUIRED \ + false //Set this line to true to activate webserver authentication (this line must not be commented). +#define HTTP_USERNAME "admin" // username to webserver authentication; +#define HTTP_PASSWORD "admin" // password to webserver authentication; + #define MQTT_SERVER "192.168.xxx.yyy" // mqtt server address +#define MQTT_PORT 1883 // mqtt server port #define MQTT_USER NULL // mqtt username, leave blank for no authentication #define MQTT_PASSWORD NULL // mqtt password, leave blank for no authentication diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index 823d46a0..73e475c9 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -82,8 +82,6 @@ #define WIFI //#define WIFICONFIG //Enable this line to set a static IP address / gateway /subnet mask for the device. see USER_SETTINGS.cpp for the settings #define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings. -#define WEBSERVER_AUTH_REQUIRED \ - false //Set this line to true to activate webserver authentication (this line must not be commented). Refer to USER_SETTINGS.cpp for setting the credentials. #define WIFIAP //Disable this line to permanently disable WIFI AP mode (make sure to hardcode ssid and password of you home wifi network). When enabled WIFI AP can still be disabled by a setting in the future. #define MDNSRESPONDER //Enable this line to enable MDNS, allows battery monitor te be found by .local address. Requires WEBSERVER to be enabled. #define LOAD_SAVED_SETTINGS_ON_BOOT //Enable this line to read settings stored via the webserver on boot (overrides Wifi/battery settings set below) @@ -92,7 +90,6 @@ /* MQTT options */ // #define MQTT // Enable this line to enable MQTT -#define MQTT_PORT 1883 #define MQTT_MANUAL_TOPIC_OBJECT_NAME // Enable this to use custom MQTT topic, object ID prefix, and device name. \ // WARNING: If this is not defined, the previous default naming format \ // 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used. \ diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp index 5468c704..d5f3a3b2 100644 --- a/Software/src/devboard/webserver/webserver.cpp +++ b/Software/src/devboard/webserver/webserver.cpp @@ -1,6 +1,7 @@ #include "webserver.h" #include #include +#include "../../../USER_SECRETS.h" #include "../../datalayer/datalayer.h" #include "../../datalayer/datalayer_extended.h" #include "../../lib/bblanchon-ArduinoJson/ArduinoJson.h"