mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-25 20:06:08 +00:00
Support changing context path to accomodate being behind a proxy
This commit is contained in:
@@ -89,6 +89,13 @@ struct MqttConfig {
|
||||
}; // 676
|
||||
|
||||
struct WebConfig {
|
||||
uint8_t security;
|
||||
char username[37];
|
||||
char password[37];
|
||||
char context[37];
|
||||
}; // 112
|
||||
|
||||
struct WebConfig103 {
|
||||
uint8_t security;
|
||||
char username[64];
|
||||
char password[64];
|
||||
|
||||
@@ -217,8 +217,9 @@ bool AmsConfiguration::getWebConfig(WebConfig& config) {
|
||||
|
||||
bool AmsConfiguration::setWebConfig(WebConfig& config) {
|
||||
|
||||
stripNonAscii((uint8_t*) config.username, 64);
|
||||
stripNonAscii((uint8_t*) config.password, 64);
|
||||
stripNonAscii((uint8_t*) config.username, 37);
|
||||
stripNonAscii((uint8_t*) config.password, 37);
|
||||
stripNonAscii((uint8_t*) config.context, 37);
|
||||
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
EEPROM.put(CONFIG_WEB_START, config);
|
||||
@@ -989,7 +990,7 @@ bool AmsConfiguration::relocateConfig103() {
|
||||
PriceServiceConfig price;
|
||||
NetworkConfig wifi;
|
||||
EnergyAccountingConfig eac;
|
||||
WebConfig web;
|
||||
WebConfig103 web103;
|
||||
DebugConfig debug;
|
||||
DomoticzConfig domo;
|
||||
NtpConfig ntp;
|
||||
@@ -1003,7 +1004,7 @@ bool AmsConfiguration::relocateConfig103() {
|
||||
EEPROM.get(CONFIG_ENTSOE_START_103, price);
|
||||
EEPROM.get(CONFIG_WIFI_START_103, wifi);
|
||||
EEPROM.get(CONFIG_ENERGYACCOUNTING_START_103, eac);
|
||||
EEPROM.get(CONFIG_WEB_START_103, web);
|
||||
EEPROM.get(CONFIG_WEB_START_103, web103);
|
||||
EEPROM.get(CONFIG_DEBUG_START_103, debug);
|
||||
EEPROM.get(CONFIG_DOMOTICZ_START_103, domo);
|
||||
EEPROM.get(CONFIG_NTP_START_103, ntp);
|
||||
@@ -1035,6 +1036,11 @@ bool AmsConfiguration::relocateConfig103() {
|
||||
gpio103.ledBehaviour
|
||||
};
|
||||
|
||||
WebConfig web = {web103.security};
|
||||
strcpy(web.username, web103.username);
|
||||
strcpy(web.password, web103.password);
|
||||
strcpy(web.context, "");
|
||||
|
||||
EEPROM.put(CONFIG_UPGRADE_INFO_START, upinfo);
|
||||
EEPROM.put(CONFIG_NETWORK_START, wifi);
|
||||
EEPROM.put(CONFIG_METER_START, meter);
|
||||
|
||||
Reference in New Issue
Block a user