mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-03 20:13:51 +01:00
OTA security added
This commit is contained in:
parent
310b3afe59
commit
a396c3a9bf
|
|
@ -46,12 +46,16 @@
|
|||
"server": "192.168.0.100",
|
||||
"port": 514
|
||||
},
|
||||
"bme": {
|
||||
"active": false
|
||||
},
|
||||
"ota": {
|
||||
"username":"richon",
|
||||
"password": "totoro"
|
||||
},
|
||||
"other": {
|
||||
"beaconInterval": 15,
|
||||
"rememberStationTime": 30,
|
||||
"sendBatteryVoltage": false
|
||||
},
|
||||
"bme": {
|
||||
"active": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,9 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
|||
syslog.port = data["syslog"]["port"].as<int>();
|
||||
|
||||
bme.active = data["bme"]["active"].as<bool>();
|
||||
|
||||
ota.username = data["ota"]["username"].as<String>();
|
||||
ota.password = data["ota"]["password"].as<String>();
|
||||
|
||||
configFile.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,14 @@ public:
|
|||
bool active;
|
||||
};
|
||||
|
||||
class OTA {
|
||||
public:
|
||||
String username;
|
||||
String password;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Configuration {
|
||||
public:
|
||||
|
||||
|
|
@ -74,6 +82,7 @@ public:
|
|||
Display display;
|
||||
SYSLOG syslog;
|
||||
BME bme;
|
||||
OTA ota;
|
||||
|
||||
|
||||
Configuration();
|
||||
|
|
|
|||
|
|
@ -276,7 +276,11 @@ void startOTAServer() {
|
|||
request->send(SPIFFS, "/index2.html", "text/html");
|
||||
});
|
||||
|
||||
AsyncElegantOTA.begin(&server);
|
||||
if (Config.ota.username != "" && Config.ota.password != "") {
|
||||
AsyncElegantOTA.begin(&server, Config.ota.username.c_str(), Config.ota.password.c_str());
|
||||
} else {
|
||||
AsyncElegantOTA.begin(&server);
|
||||
}
|
||||
server.begin();
|
||||
Serial.println("init : OTA Server ... done!");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue