mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add HTTP_USERNAME and HTTP_PASSWORD to user_config_override
This commit is contained in:
parent
2dbc84f4d3
commit
8d8b2a194f
@ -18,15 +18,21 @@
|
|||||||
WiFi Settings
|
WiFi Settings
|
||||||
**************************************************/
|
**************************************************/
|
||||||
#define WIFI_SSID ""
|
#define WIFI_SSID ""
|
||||||
#define WIFI_PASSW ""
|
#define WIFI_PASSWORD ""
|
||||||
|
|
||||||
/***************************************************
|
/***************************************************
|
||||||
MQTT Settings
|
Http Server Settings
|
||||||
**************************************************/
|
**************************************************/
|
||||||
#define MQTT_HOST ""
|
#define HTTP_USERNAME ""
|
||||||
|
#define HTTP_PASSWORD ""
|
||||||
|
|
||||||
|
/***************************************************
|
||||||
|
MQTT Client Settings
|
||||||
|
**************************************************/
|
||||||
|
#define MQTT_HOSTNAME ""
|
||||||
#define MQTT_PORT 1883
|
#define MQTT_PORT 1883
|
||||||
#define MQTT_USER ""
|
#define MQTT_USERNAME ""
|
||||||
#define MQTT_PASSW ""
|
#define MQTT_PASSWORD ""
|
||||||
#define MQTT_PREFIX "hasp"
|
#define MQTT_PREFIX "hasp"
|
||||||
#define MQTT_NODENAME "plate01"
|
#define MQTT_NODENAME "plate01"
|
||||||
#define MQTT_GROUPNAME "plates"
|
#define MQTT_GROUPNAME "plates"
|
||||||
|
@ -7,15 +7,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
// #if defined(WINDOWS) || defined(POSIX)
|
|
||||||
// #define __FlashStringHelper char
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
#ifdef ARDUINO
|
|
||||||
#include "PubSubClient.h"
|
|
||||||
extern PubSubClient mqttClient;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MQTT_ERR_OK = 0,
|
MQTT_ERR_OK = 0,
|
||||||
MQTT_ERR_DISABLED = -1,
|
MQTT_ERR_DISABLED = -1,
|
||||||
@ -85,20 +76,32 @@ bool mqttSetConfig(const JsonObject& settings);
|
|||||||
#define MQTT_GROUPNAME "plates";
|
#define MQTT_GROUPNAME "plates";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MQTT_HOSTNAME
|
||||||
#ifndef MQTT_HOST
|
#ifndef MQTT_HOST
|
||||||
#define MQTT_HOST "";
|
#define MQTT_HOSTNAME "";
|
||||||
|
#else
|
||||||
|
#define MQTT_HOSTNAME MQTT_HOST;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MQTT_PORT
|
#ifndef MQTT_PORT
|
||||||
#define MQTT_PORT 1883;
|
#define MQTT_PORT 1883;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MQTT_USERNAME
|
||||||
#ifndef MQTT_USER
|
#ifndef MQTT_USER
|
||||||
#define MQTT_USER "";
|
#define MQTT_USERNAME "";
|
||||||
|
#else
|
||||||
|
#define MQTT_USERNAME MQTT_USER;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MQTT_PASSWORD
|
||||||
#ifndef MQTT_PASSW
|
#ifndef MQTT_PASSW
|
||||||
#define MQTT_PASSW "";
|
#define MQTT_PASSWORD "";
|
||||||
|
#else
|
||||||
|
#define MQTT_PASSWORD MQTT_PASSW;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // HASP_MQTT_H
|
#endif // HASP_MQTT_H
|
@ -66,9 +66,9 @@ bool mqttHAautodiscover = true;
|
|||||||
std::recursive_mutex dispatch_mtx;
|
std::recursive_mutex dispatch_mtx;
|
||||||
std::recursive_mutex publish_mtx;
|
std::recursive_mutex publish_mtx;
|
||||||
|
|
||||||
char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOST;
|
char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOSTNAME;
|
||||||
char mqttUser[MAX_USERNAME_LENGTH] = MQTT_USER;
|
char mqttUser[MAX_USERNAME_LENGTH] = MQTT_USERNAME;
|
||||||
char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSW;
|
char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSWORD;
|
||||||
// char mqttNodeName[16] = MQTT_NODENAME;
|
// char mqttNodeName[16] = MQTT_NODENAME;
|
||||||
char mqttGroupName[16] = MQTT_GROUPNAME;
|
char mqttGroupName[16] = MQTT_GROUPNAME;
|
||||||
uint16_t mqttPort = MQTT_PORT;
|
uint16_t mqttPort = MQTT_PORT;
|
||||||
|
@ -63,9 +63,9 @@ uint32_t mqttPublishCount;
|
|||||||
uint32_t mqttReceiveCount;
|
uint32_t mqttReceiveCount;
|
||||||
uint32_t mqttFailedCount;
|
uint32_t mqttFailedCount;
|
||||||
|
|
||||||
std::string mqttServer = MQTT_HOST;
|
std::string mqttServer = MQTT_HOSTNAME;
|
||||||
std::string mqttUser = MQTT_USER;
|
std::string mqttUser = MQTT_USERNAME;
|
||||||
std::string mqttPassword = MQTT_PASSW;
|
std::string mqttPassword = MQTT_PASSWORD;
|
||||||
std::string mqttGroupName = MQTT_GROUPNAME;
|
std::string mqttGroupName = MQTT_GROUPNAME;
|
||||||
uint16_t mqttPort = MQTT_PORT;
|
uint16_t mqttPort = MQTT_PORT;
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ uint32_t mqttPublishCount;
|
|||||||
uint32_t mqttReceiveCount;
|
uint32_t mqttReceiveCount;
|
||||||
uint32_t mqttFailedCount;
|
uint32_t mqttFailedCount;
|
||||||
|
|
||||||
char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOST;
|
char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOSTNAME;
|
||||||
char mqttUsername[MAX_USERNAME_LENGTH] = MQTT_USER;
|
char mqttUsername[MAX_USERNAME_LENGTH] = MQTT_USERNAME;
|
||||||
char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSW;
|
char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSWORD;
|
||||||
// char mqttNodeName[16] = MQTT_NODENAME;
|
// char mqttNodeName[16] = MQTT_NODENAME;
|
||||||
char mqttGroupName[16] = MQTT_GROUPNAME;
|
char mqttGroupName[16] = MQTT_GROUPNAME;
|
||||||
uint16_t mqttPort = MQTT_PORT;
|
uint16_t mqttPort = MQTT_PORT;
|
||||||
|
@ -38,16 +38,8 @@ SPIClass espSPI(ESPSPI_MOSI, ESPSPI_MISO, ESPSPI_SCLK); // SPI port where esp is
|
|||||||
#endif
|
#endif
|
||||||
//#include "DNSserver.h"
|
//#include "DNSserver.h"
|
||||||
|
|
||||||
#ifndef WIFI_SSID
|
|
||||||
#define WIFI_SSID ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WIFI_PASSW
|
|
||||||
#define WIFI_PASSW ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char wifiSsid[MAX_USERNAME_LENGTH] = WIFI_SSID;
|
char wifiSsid[MAX_USERNAME_LENGTH] = WIFI_SSID;
|
||||||
char wifiPassword[MAX_PASSWORD_LENGTH] = WIFI_PASSW;
|
char wifiPassword[MAX_PASSWORD_LENGTH] = WIFI_PASSWORD;
|
||||||
char wifiIpAddress[16] = "";
|
char wifiIpAddress[16] = "";
|
||||||
uint16_t wifiReconnectCounter = 0;
|
uint16_t wifiReconnectCounter = 0;
|
||||||
bool wifiOnline = false;
|
bool wifiOnline = false;
|
||||||
|
@ -30,4 +30,16 @@ bool wifiGetConfig(const JsonObject& settings);
|
|||||||
bool wifiSetConfig(const JsonObject& settings);
|
bool wifiSetConfig(const JsonObject& settings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIFI_SSID
|
||||||
|
#define WIFI_SSID ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIFI_PASSWORD
|
||||||
|
#ifndef WIFI_PASSW
|
||||||
|
#define WIFI_PASSWORD "";
|
||||||
|
#else
|
||||||
|
#define WIFI_PASSWORD WIFI_PASSW;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -32,49 +32,6 @@
|
|||||||
// #include "user_config_override.h"
|
// #include "user_config_override.h"
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
/* clang-format off */
|
|
||||||
//default theme
|
|
||||||
#ifndef D_HTTP_COLOR_TEXT
|
|
||||||
#define D_HTTP_COLOR_TEXT "#000" // Global text color - Black
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BACKGROUND
|
|
||||||
#define D_HTTP_COLOR_BACKGROUND "#fff" // Global background color - White
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_INPUT_TEXT
|
|
||||||
#define D_HTTP_COLOR_INPUT_TEXT "#000" // Input text color - Black
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_INPUT
|
|
||||||
#define D_HTTP_COLOR_INPUT "#fff" // Input background color - White
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_INPUT_WARNING
|
|
||||||
#define D_HTTP_COLOR_INPUT_WARNING "#f00" // Input warning border color - Red
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BUTTON_TEXT
|
|
||||||
#define D_HTTP_COLOR_BUTTON_TEXT "#fff" // Button text color - White
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BUTTON
|
|
||||||
#define D_HTTP_COLOR_BUTTON "#1fa3ec" // Button color - Vivid blue
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BUTTON_HOVER
|
|
||||||
#define D_HTTP_COLOR_BUTTON_HOVER "#0083cc" // Button color - Olympic blue
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BUTTON_RESET
|
|
||||||
#define D_HTTP_COLOR_BUTTON_RESET "#f00" // Restart/Reset button color - red
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_BUTTON_RESET_HOVER
|
|
||||||
#define D_HTTP_COLOR_BUTTON_RESET_HOVER "#b00" // Restart/Reset button color - Dark red
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_GROUP_TEXT
|
|
||||||
#define D_HTTP_COLOR_GROUP_TEXT "#000" // Container text color - Black
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_GROUP
|
|
||||||
#define D_HTTP_COLOR_GROUP "#f3f3f3" // Container color - Light gray
|
|
||||||
#endif
|
|
||||||
#ifndef D_HTTP_COLOR_FOOTER_TEXT
|
|
||||||
#define D_HTTP_COLOR_FOOTER_TEXT "#0083cc" // Text color of the page footer
|
|
||||||
#endif
|
|
||||||
/* clang-format on */
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
File fsUploadFile;
|
File fsUploadFile;
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,13 +6,21 @@
|
|||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
|
#ifndef HTTP_USERNAME
|
||||||
|
#define HTTP_USERNAME "";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HTTP_PASSWORD
|
||||||
|
#define HTTP_PASSWORD "";
|
||||||
|
#endif
|
||||||
|
|
||||||
struct hasp_http_config_t
|
struct hasp_http_config_t
|
||||||
{
|
{
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
uint16_t port = 80;
|
uint16_t port = 80;
|
||||||
|
|
||||||
char username[MAX_USERNAME_LENGTH] = "";
|
char username[MAX_USERNAME_LENGTH] = HTTP_USERNAME;
|
||||||
char password[MAX_PASSWORD_LENGTH] = "";
|
char password[MAX_PASSWORD_LENGTH] = HTTP_PASSWORD;
|
||||||
};
|
};
|
||||||
|
|
||||||
void httpSetup();
|
void httpSetup();
|
||||||
@ -28,4 +36,47 @@ bool httpGetConfig(const JsonObject& settings);
|
|||||||
bool httpSetConfig(const JsonObject& settings);
|
bool httpSetConfig(const JsonObject& settings);
|
||||||
#endif // HASP_USE_CONFIG
|
#endif // HASP_USE_CONFIG
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
|
//default theme
|
||||||
|
#ifndef D_HTTP_COLOR_TEXT
|
||||||
|
#define D_HTTP_COLOR_TEXT "#000" // Global text color - Black
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BACKGROUND
|
||||||
|
#define D_HTTP_COLOR_BACKGROUND "#fff" // Global background color - White
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_INPUT_TEXT
|
||||||
|
#define D_HTTP_COLOR_INPUT_TEXT "#000" // Input text color - Black
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_INPUT
|
||||||
|
#define D_HTTP_COLOR_INPUT "#fff" // Input background color - White
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_INPUT_WARNING
|
||||||
|
#define D_HTTP_COLOR_INPUT_WARNING "#f00" // Input warning border color - Red
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BUTTON_TEXT
|
||||||
|
#define D_HTTP_COLOR_BUTTON_TEXT "#fff" // Button text color - White
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BUTTON
|
||||||
|
#define D_HTTP_COLOR_BUTTON "#1fa3ec" // Button color - Vivid blue
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BUTTON_HOVER
|
||||||
|
#define D_HTTP_COLOR_BUTTON_HOVER "#0083cc" // Button color - Olympic blue
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BUTTON_RESET
|
||||||
|
#define D_HTTP_COLOR_BUTTON_RESET "#f00" // Restart/Reset button color - red
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_BUTTON_RESET_HOVER
|
||||||
|
#define D_HTTP_COLOR_BUTTON_RESET_HOVER "#b00" // Restart/Reset button color - Dark red
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_GROUP_TEXT
|
||||||
|
#define D_HTTP_COLOR_GROUP_TEXT "#000" // Container text color - Black
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_GROUP
|
||||||
|
#define D_HTTP_COLOR_GROUP "#f3f3f3" // Container color - Light gray
|
||||||
|
#endif
|
||||||
|
#ifndef D_HTTP_COLOR_FOOTER_TEXT
|
||||||
|
#define D_HTTP_COLOR_FOOTER_TEXT "#0083cc" // Text color of the page footer
|
||||||
|
#endif
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user