Merge pull request #1568 from MichaelDvP/dev

fix #1565 and workaround for #1564
This commit is contained in:
Proddy
2024-01-20 12:22:31 +01:00
committed by GitHub
19 changed files with 133 additions and 56 deletions

View File

@@ -24,7 +24,7 @@
"@babel/core": "^7.23.7",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.4",
"@mui/icons-material": "^5.15.5",
"@mui/material": "^5.15.5",
"@table-library/react-table-library": "4.1.7",
"@types/imagemin": "^8.0.5",
@@ -43,7 +43,7 @@
"react-dom": "latest",
"react-dropzone": "^14.2.3",
"react-icons": "^5.0.1",
"react-router-dom": "^6.21.2",
"react-router-dom": "^6.21.3",
"react-toastify": "^10.0.3",
"sockette": "^2.0.6",
"typesafe-i18n": "^5.26.2",
@@ -69,8 +69,8 @@
"preact": "^10.19.3",
"prettier": "^3.2.4",
"rollup-plugin-visualizer": "^5.12.0",
"terser": "^5.26.0",
"vite": "^5.0.11",
"terser": "^5.27.0",
"vite": "^5.0.12",
"vite-plugin-imagemin": "^0.6.1",
"vite-tsconfig-paths": "^4.3.1"
},

View File

@@ -50,8 +50,10 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, isUploading, pr
const progressText = () => {
if (uploading) {
if (progress.total) {
return LL.UPLOADING() + ': ' + Math.round((progress.loaded * 100) / progress.total) + '%';
if (progress.total && progress.loaded) {
return progress.loaded <= progress.total
? LL.UPLOADING() + ': ' + Math.round((progress.loaded * 100) / progress.total) + '%'
: LL.UPLOADING() + ': ' + Math.round((progress.total * 100) / progress.loaded) + '%';
}
}
return LL.UPLOAD_DROP_TEXT();
@@ -83,7 +85,13 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, isUploading, pr
<Box width="100%" p={2}>
<LinearProgress
variant="determinate"
value={progress.total === 0 ? 0 : Math.round((progress.loaded * 100) / progress.total)}
value={
progress.total === 0 || progress.loaded === 0
? 0
: progress.loaded <= progress.total
? Math.round((progress.loaded * 100) / progress.total)
: Math.round((progress.total * 100) / progress.loaded)
}
/>
</Box>
<Button startIcon={<CancelIcon />} variant="outlined" color="secondary" onClick={onCancel}>

View File

@@ -9,7 +9,6 @@ export interface NTPStatus {
utc_time: string;
local_time: string;
server: string;
uptime: number;
}
export interface NTPSettings {

View File

@@ -401,7 +401,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/runtime@npm:^7.23.7, @babel/runtime@npm:^7.23.8":
"@babel/runtime@npm:^7.23.8":
version: 7.23.8
resolution: "@babel/runtime@npm:7.23.8"
dependencies:
@@ -999,11 +999,11 @@ __metadata:
languageName: node
linkType: hard
"@mui/icons-material@npm:^5.15.4":
version: 5.15.4
resolution: "@mui/icons-material@npm:5.15.4"
"@mui/icons-material@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/icons-material@npm:5.15.5"
dependencies:
"@babel/runtime": "npm:^7.23.7"
"@babel/runtime": "npm:^7.23.8"
peerDependencies:
"@mui/material": ^5.0.0
"@types/react": ^17.0.0 || ^18.0.0
@@ -1011,7 +1011,7 @@ __metadata:
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 1c9be5d3e23a6b565a36d36065e8a2480feebfb497ea7367f7fd32f90164e46420e5be8117fcfd05f2a3c1940b8fa48f56caccc19da78849fc8bda037f186954
checksum: 25feb86a76ce83c81391c95d0c1c867e988cc7bc1b5a05c5698b71cb3cd1005fd148b07c2fa8908cda9fc4e44ea8b6e0fd2197bc0abafac0ee4880b477852eea
languageName: node
linkType: hard
@@ -1829,7 +1829,7 @@ __metadata:
"@babel/core": "npm:^7.23.7"
"@emotion/react": "npm:^11.11.3"
"@emotion/styled": "npm:^11.11.0"
"@mui/icons-material": "npm:^5.15.4"
"@mui/icons-material": "npm:^5.15.5"
"@mui/material": "npm:^5.15.5"
"@preact/compat": "npm:^17.1.2"
"@preact/preset-vite": "npm:^2.8.1"
@@ -1866,14 +1866,14 @@ __metadata:
react-dom: "npm:latest"
react-dropzone: "npm:^14.2.3"
react-icons: "npm:^5.0.1"
react-router-dom: "npm:^6.21.2"
react-router-dom: "npm:^6.21.3"
react-toastify: "npm:^10.0.3"
rollup-plugin-visualizer: "npm:^5.12.0"
sockette: "npm:^2.0.6"
terser: "npm:^5.26.0"
terser: "npm:^5.27.0"
typesafe-i18n: "npm:^5.26.2"
typescript: "npm:^5.3.3"
vite: "npm:^5.0.11"
vite: "npm:^5.0.12"
vite-plugin-imagemin: "npm:^0.6.1"
vite-tsconfig-paths: "npm:^4.3.1"
languageName: unknown
@@ -7218,27 +7218,27 @@ __metadata:
languageName: node
linkType: hard
"react-router-dom@npm:^6.21.2":
version: 6.21.2
resolution: "react-router-dom@npm:6.21.2"
"react-router-dom@npm:^6.21.3":
version: 6.21.3
resolution: "react-router-dom@npm:6.21.3"
dependencies:
"@remix-run/router": "npm:1.14.2"
react-router: "npm:6.21.2"
react-router: "npm:6.21.3"
peerDependencies:
react: ">=16.8"
react-dom: ">=16.8"
checksum: 24d1470e68f11369776c623b8873c8cf0af476d102317cb3aa6b13b48c86908f10a6e51209ce24dccf40e429538d4e23fda796c190f2ff98f894cb476d51f44d
checksum: 6e23e35d02e5c83847c8e47d7912d1f6c2c42a35f2317802031bdd993a8205468138a045ff34f67fe807fe9f7dc9d0995ee05bab25aedc0bf978e620ac132815
languageName: node
linkType: hard
"react-router@npm:6.21.2":
version: 6.21.2
resolution: "react-router@npm:6.21.2"
"react-router@npm:6.21.3":
version: 6.21.3
resolution: "react-router@npm:6.21.3"
dependencies:
"@remix-run/router": "npm:1.14.2"
peerDependencies:
react: ">=16.8"
checksum: 08701bfe9e7b860442dd0f3c6e36d3ea6106d86db5ec9da930fd56d5782a13b82612826de7dd31bb38832f3fa76437d7a0ca36e63a76256f62d5b738f529a48c
checksum: 3d5107cfdb440519d84e6ad6d95454e3bf41ec97677b95f7b2a7f281f8ddf191b765cf1b599ead951f3cd33ed4429f140590d74a01cfdf835dc2f812023a978a
languageName: node
linkType: hard
@@ -8338,9 +8338,9 @@ __metadata:
languageName: node
linkType: hard
"terser@npm:^5.26.0":
version: 5.26.0
resolution: "terser@npm:5.26.0"
"terser@npm:^5.27.0":
version: 5.27.0
resolution: "terser@npm:5.27.0"
dependencies:
"@jridgewell/source-map": "npm:^0.3.3"
acorn: "npm:^8.8.2"
@@ -8348,7 +8348,7 @@ __metadata:
source-map-support: "npm:~0.5.20"
bin:
terser: bin/terser
checksum: 0282c5c065cbfa1e725d5609b99579252bc20b83cd1d75e8ab8b46d5da2c9d0fcfc453a12624f2d2d4c1240bfa0017a90fcf1e3b88258e5842fca1b0b82be8d8
checksum: 9b2c5cb00747dea5994034ca064fb3cc7efc1be6b79a35247662d51ab43bdbe9cbf002bbf29170b5f3bd068c811d0212e22d94acd2cf0d8562687b96f1bffc9f
languageName: node
linkType: hard
@@ -8764,9 +8764,9 @@ __metadata:
languageName: node
linkType: hard
"vite@npm:^5.0.11":
version: 5.0.11
resolution: "vite@npm:5.0.11"
"vite@npm:^5.0.12":
version: 5.0.12
resolution: "vite@npm:5.0.12"
dependencies:
esbuild: "npm:^0.19.3"
fsevents: "npm:~2.3.3"
@@ -8800,7 +8800,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: f1a8fea35ed9f162d7a10fd13efb2c96637028b0a319d726aeec8b31e20e4d047272bda5df82167618e7774a520236c66f3093ed172802660aec5227814072f4
checksum: ed0bb26a0d0c8e1dae0b70af9e36adffd7e15d80297443fe4da762596dc81570bad7f0291f590a57c1553f5e435338d8c7ffc483bd9431a95c09d9ac90665fad
languageName: node
linkType: hard

View File

@@ -1,6 +1,11 @@
ArduinoJson: change log
=======================
v7.0.2 (2024-01-19)
------
* Fix assertion `poolIndex < count_` after `JsonDocument::clear()` (issue #2034)
v7.0.1 (2024-01-10)
------

View File

@@ -0,0 +1,25 @@
# ArduinoJson - https://arduinojson.org
# Copyright © 2014-2024, Benoit BLANCHON
# MIT License
cmake_minimum_required(VERSION 3.15)
if(ESP_PLATFORM)
# Build ArduinoJson as an ESP-IDF component
idf_component_register(INCLUDE_DIRS src)
return()
endif()
project(ArduinoJson VERSION 7.0.2)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
add_subdirectory(src)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
include(extras/CompileOptions.cmake)
add_subdirectory(extras/tests)
add_subdirectory(extras/fuzzing)
endif()

View File

@@ -0,0 +1,13 @@
version: "7.0.2"
description: >-
A simple and efficient JSON library for embedded C++.
⭐ 6444 stars on GitHub!
Supports serialization, deserialization, MessagePack, streams, filtering, and more.
Fully tested and documented.
url: https://arduinojson.org/
files:
exclude:
- "**/.vs/**/*"
- ".devcontainer/**/*"
- "examples/**/*"
- "extras/**/*"

View File

@@ -0,0 +1,23 @@
{
"name": "ArduinoJson",
"keywords": "json, rest, http, web",
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6444 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
"homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json",
"repository": {
"type": "git",
"url": "https://github.com/bblanchon/ArduinoJson.git"
},
"version": "7.0.2",
"authors": {
"name": "Benoit Blanchon",
"url": "https://blog.benoitblanchon.fr"
},
"export": {
"include": ["src", "examples", "LICENSE.txt", "ArduinoJson.h"]
},
"frameworks": "*",
"platforms": "*",
"build": {
"libArchive": false
}
}

View File

@@ -0,0 +1,11 @@
name=ArduinoJson
version=7.0.2
author=Benoit Blanchon <blog.benoitblanchon.fr>
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
sentence=A simple and efficient JSON library for embedded C++.
paragraph=⭐ 6444 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
category=Data Processing
url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties
architectures=*
repository=https://github.com/bblanchon/ArduinoJson.git
license=MIT

View File

@@ -65,7 +65,7 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
}
// Reduces the capacity of the memory pool to match the current usage.
// https://arduinojson.org/v7/api/JsonDocument/shrinktofit/
// https://arduinojson.org/v7/api/jsondocument/shrinktofit/
void shrinkToFit() {
resources_.shrinkToFit();
}

View File

@@ -103,6 +103,7 @@ class VariantPoolList {
for (PoolCount i = 0; i < count_; i++)
pools_[i].destroy(allocator);
count_ = 0;
freeList_ = NULL_SLOT;
if (pools_ != preallocatedPools_) {
allocator->deallocate(pools_);
pools_ = preallocatedPools_;

View File

@@ -4,8 +4,8 @@
#pragma once
#define ARDUINOJSON_VERSION "7.0.1"
#define ARDUINOJSON_VERSION "7.0.2"
#define ARDUINOJSON_VERSION_MAJOR 7
#define ARDUINOJSON_VERSION_MINOR 0
#define ARDUINOJSON_VERSION_REVISION 1
#define ARDUINOJSON_VERSION_MACRO V701
#define ARDUINOJSON_VERSION_REVISION 2
#define ARDUINOJSON_VERSION_MACRO V702

View File

@@ -679,7 +679,7 @@ bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int
// if we're filtering on an attribute, go find it
if (attribute_s) {
if (output.containsKey(attribute_s)) {
JsonVariant data = output[attribute_s];
String data = output[attribute_s].as<String>();
output.clear();
output["api_data"] = data;
return true;

View File

@@ -533,15 +533,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
if (return_code == CommandRet::OK && json.size()) {
if (json.containsKey("api_data")) {
JsonVariant data = json["api_data"];
if (data.is<int>()) {
shell.printfln("%d", data.as<int>());
} else if (data.is<float>()) {
char s[10];
shell.println(Helpers::render_value(s, data.as<float>(), 1));
} else {
shell.println(data.as<const char *>());
}
String data = json["api_data"].as<String>();
shell.println(data.c_str());
return;
}
serializeJsonPretty(doc, shell);

View File

@@ -1529,7 +1529,7 @@ bool EMSdevice::get_value_info(JsonObject output, const char * cmd, const int8_t
EMSESP::logger().debug("Attribute '%s'", attribute_s);
#endif
if (json.containsKey(attribute_s)) {
JsonVariant data = json[attribute_s];
String data = json[attribute_s].as<String>();
output.clear();
output["api_data"] = data;
return true;

View File

@@ -426,7 +426,7 @@ bool TemperatureSensor::get_value_info(JsonObject output, const char * cmd, cons
// if we're filtering on an attribute, go find it
if (attribute_s) {
if (output.containsKey(attribute_s)) {
JsonVariant data = output[attribute_s];
String data = output[attribute_s].as<String>();
output.clear();
output["api_data"] = data;
return true;

View File

@@ -134,8 +134,8 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
// if we're returning single values, just sent as plain text
// https://github.com/emsesp/EMS-ESP32/issues/462#issuecomment-1093877210
if (output.containsKey("api_data")) {
JsonVariant data = output["api_data"];
request->send(200, "text/plain; charset=utf-8", data.as<String>());
String data = output["api_data"].as<String>();
request->send(200, "text/plain; charset=utf-8", data);
api_count_++;
delete response;
return;

View File

@@ -308,7 +308,7 @@ bool WebCustomEntityService::get_value_info(JsonObject output, const char * cmd)
render_value(output, entity, true);
if (attribute_s) {
if (output.containsKey(attribute_s)) {
JsonVariant data = output[attribute_s];
String data = output[attribute_s].as<String>();
output.clear();
output["api_data"] = data;
return true;

View File

@@ -177,7 +177,6 @@ bool WebSchedulerService::get_value_info(JsonObject output, const char * cmd) {
attribute_s = breakp + 1;
}
JsonVariant data;
for (const ScheduleItem & scheduleItem : *scheduleItems) {
if (Helpers::toLower(scheduleItem.name) == Helpers::toLower(command_s)) {
output["name"] = scheduleItem.name;
@@ -199,7 +198,7 @@ bool WebSchedulerService::get_value_info(JsonObject output, const char * cmd) {
}
if (attribute_s && output.containsKey(attribute_s)) {
data = output[attribute_s];
String data = output[attribute_s].as<String>();
output.clear();
output["api_data"] = data;
}