diff --git a/interface/src/app/settings/DownloadUpload.tsx b/interface/src/app/settings/DownloadUpload.tsx index 6905c92b9..02a373e12 100644 --- a/interface/src/app/settings/DownloadUpload.tsx +++ b/interface/src/app/settings/DownloadUpload.tsx @@ -112,6 +112,7 @@ const DownloadUpload = () => { const handleDownload = useCallback( (type: string) => () => { void sendExportData(type); + setConfirmBackup(false); }, [sendExportData] ); diff --git a/interface/src/components/upload/DragNdrop.tsx b/interface/src/components/upload/DragNdrop.tsx index fdcc0cc9d..0305b9492 100644 --- a/interface/src/components/upload/DragNdrop.tsx +++ b/interface/src/components/upload/DragNdrop.tsx @@ -213,19 +213,8 @@ const DragNdrop = ({ text, onFileSelected }: DragNdropProps) => { {upgradeImportantMessageType === 2 && LL.UPGRADE_IMPORTANT_MESSAGES_2()} - {upgradeImportantMessageType === 1 && ( - <> - {LL.UPGRADE_IMPORTANT_MESSAGES_1()} - - - {LL.DOWNLOAD_SYSTEM_BACKUP()} - - - - )}{' '} + {upgradeImportantMessageType === 1 && + LL.UPGRADE_IMPORTANT_MESSAGES_1()} label; @@ -332,10 +332,8 @@ void System::get_partition_info() { p_info.version = EMSESP::nvs_.getString(part->label, "").c_str(); char c[20]; snprintf(c, sizeof(c), "d_%s", (const char *)part->label); - time_t d = EMSESP::nvs_.getULong(c, 0); - char time_string[25]; - strftime(time_string, sizeof(time_string), "%FT%T", localtime(&d)); - p_info.install_date = d > 1500000000L ? time_string : ""; + time_t d = EMSESP::nvs_.getULong(c, 0); + p_info.install_date = d > 1500000000L ? d : 0; // store UTC epoch; formatted to local time at render if (!p_info.version.empty()) { esp_image_metadata_t meta = {}; @@ -355,7 +353,7 @@ void System::get_partition_info() { #endif } -// set NTP install time/date for the current partition +// set install time/date for the current partition, in UTC // assumes NTP is connected and working void System::set_partition_install_date() { #ifndef EMSESP_STANDALONE @@ -1240,11 +1238,18 @@ void System::show_system(uuid::console::Shell & shell) { if (partition.second.version.empty()) { continue; // no version, empty string } + std::string installed; + if (partition.second.install_date > 0) { + char time_string[25]; + time_t d = partition.second.install_date; + strftime(time_string, sizeof(time_string), "%FT%T", localtime(&d)); + installed = std::string(", installed on ") + time_string; + } shell.printfln(" %s: v%s (%d KB%s) %s", partition.first.c_str(), partition.second.version.c_str(), partition.second.size, - partition.second.install_date.empty() ? "" : (std::string(", installed on ") + partition.second.install_date).c_str(), + installed.c_str(), (strcmp(esp_ota_get_running_partition()->label, partition.first.c_str()) == 0) ? "** active **" : ""); } diff --git a/src/core/system.h b/src/core/system.h index d05645a37..b3ee3c242 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -83,7 +83,7 @@ enum FUSE_VALUE : uint8_t { ALL = 0, MFG = 1, MODEL = 2, BOARD = 3, REV = 4, BAT struct PartitionInfo { std::string version; size_t size; - std::string install_date; // optional, only available if NTP is connected + time_t install_date; // UTC epoch seconds; 0 if unknown. Format with localtime() at render time so it honors the current TZ. }; class System { diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index f360ff99e..aa66292b1 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -146,18 +146,27 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { } // get the partition info for each partition, including the running one - // the partition data is done once in System::start() and stored in partition_info_ + // the partition data is gathered once in System::start() and stored in partition_info_ + // install_date is stored as a UTC epoch and formatted to local time here so it honors + // the current TZ (which may not have been set yet when System::start() ran). JsonArray partitions = root["partitions"].to(); for (const auto & partition : EMSESP::system_.partition_info_) { // Skip partition if it has no version, or it's size is 0 if (partition.second.version.empty() || partition.second.size == 0) { continue; } - JsonObject part = partitions.add(); - part["partition"] = partition.first; - part["version"] = partition.second.version; - part["size"] = partition.second.size; - part["install_date"] = partition.second.install_date; + JsonObject part = partitions.add(); + part["partition"] = partition.first; + part["version"] = partition.second.version; + part["size"] = partition.second.size; + if (partition.second.install_date > 0) { + char time_string[25]; + time_t d = partition.second.install_date; + strftime(time_string, sizeof(time_string), "%FT%T", localtime(&d)); + part["install_date"] = time_string; + } else { + part["install_date"] = ""; + } } root["developer_mode"] = EMSESP::system_.developer_mode();