mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-05-04 13:05:52 +00:00
Merge branch 'dev' of https://github.com/proddy/EMS-ESP32 into dev
This commit is contained in:
@@ -1649,6 +1649,7 @@ bool System::check_upgrade() {
|
||||
}
|
||||
|
||||
// map each config filename to its human-readable section key
|
||||
#ifndef EMSESP_STANDALONE
|
||||
static const std::pair<const char *, const char *> SECTION_MAP[] = {
|
||||
{NETWORK_SETTINGS_FILE, "Network"},
|
||||
{AP_SETTINGS_FILE, "AP"},
|
||||
@@ -1661,6 +1662,7 @@ static const std::pair<const char *, const char *> SECTION_MAP[] = {
|
||||
{EMSESP_CUSTOMENTITY_FILE, "Entities"},
|
||||
{EMSESP_MODULES_FILE, "Modules"},
|
||||
};
|
||||
#endif
|
||||
|
||||
// convert a single config file into a section of the output json object
|
||||
void System::exportSettings(const std::string & type, const char * filename, JsonObject output) {
|
||||
|
||||
@@ -216,6 +216,8 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
|
||||
} else if (action == "resetMQTT" && is_admin) {
|
||||
EMSESP::mqtt_.reset_mqtt();
|
||||
ok = true;
|
||||
} else if (action == "upgradeImportantMessages") {
|
||||
ok = upgradeImportantMessages(param.c_str());
|
||||
}
|
||||
|
||||
#if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY)
|
||||
@@ -237,6 +239,20 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
// action = upgradeImportantMessages
|
||||
// returns the type of upgrade important message to show\
|
||||
// 0 = no message
|
||||
// 1 = major version upgrade
|
||||
// 2 = minor version upgrade
|
||||
// TODO finish this
|
||||
bool WebStatusService::upgradeImportantMessages(const char * version) {
|
||||
version::Semver200_version current_version(current_version_s);
|
||||
version::Semver200_version latest_version(version);
|
||||
if (latest_version > current_version) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// action = checkUpgrade
|
||||
// versions holds the latest development version and stable version in one string, comma separated
|
||||
bool WebStatusService::checkUpgrade(JsonObject root, std::string & versions) {
|
||||
|
||||
@@ -36,6 +36,7 @@ class WebStatusService {
|
||||
bool uploadURL(const char * url);
|
||||
bool setSystemStatus(const char * status);
|
||||
void allvalues(JsonObject output);
|
||||
bool upgradeImportantMessages(const char * version);
|
||||
|
||||
std::string current_version_s = EMSESP_APP_VERSION;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user