Skip to content

Commit c44d4af

Browse files
committed
Fix typos in README.md
Make allowRemove work as expected
1 parent c33479a commit c44d4af

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ You can configure the project to serve the interface from PROGMEM by uncommentin
9898

9999
Be aware that this will consume ~150k of program space which can be especially problematic if you already have a large build artefact or if you have added large javascript dependencies to the interface. The ESP32 binaries are large already, so this will be a problem if you are using one of these devices and require this type of setup.
100100

101-
A method for working around this issue can be to reduce the amount of space allocated to SPIFFS by configuring the device to use differnt partitioning. If you don't require SPIFFS other than for storing config one approach might be to configure a minimal SPIFFS partition.
101+
A method for working around this issue can be to reduce the amount of space allocated to SPIFFS by configuring the device to use different partitioning. If you don't require SPIFFS other than for storing config one approach might be to configure a minimal SPIFFS partition.
102102

103103
For a ESP32 (4mb variant) there is a handy "min_spiffs.csv" partition table which can be enabled easily:
104104

@@ -109,7 +109,7 @@ platform = espressif32
109109
board = node32s
110110
```
111111

112-
This is left as an exersise for the reader as everyone's requirements will vary.
112+
This is left as an exercise for the reader as everyone's requirements will vary.
113113

114114
### Running the interface locally
115115

@@ -147,7 +147,7 @@ The `REACT_APP_HTTP_ROOT` and `REACT_APP_WEB_SOCKET_ROOT` properties can be modi
147147

148148
You can enable CORS on the back end by uncommenting the -D ENABLE_CORS build flag in ['platformio.ini'](platformio.ini) then re-building and uploading the firmware to the device. The default settings assume you will be accessing the development server on the default port on [http://localhost:3000](http://localhost:3000) this can also be changed if required:
149149

150-
```
150+
```properties
151151
-D ENABLE_CORS
152152
-D CORS_ORIGIN=\"http://localhost:3000\"
153153
```
@@ -330,7 +330,7 @@ void loop() {
330330

331331
### Developing with the framework
332332

333-
The framework promotes a modular design and exposes features you may re-use to speed up the development of your project. Where possible it is recommended that you use the features the frameworks supplies. These are documented in this section and a comprenensive example is provided by the demo project.
333+
The framework promotes a modular design and exposes features you may re-use to speed up the development of your project. Where possible it is recommended that you use the features the frameworks supplies. These are documented in this section and a comprehensive example is provided by the demo project.
334334

335335
The following diagram visualises how the framework's modular components fit together, each feature is described in detail below.
336336

@@ -391,7 +391,7 @@ lightSettingsService.update([&](LightSettings& settings) {
391391

392392
#### Serialization
393393

394-
When transmitting settings over HTTP, WebSockets or MQTT they must to be marshalled into a serialzable form. The framework uses ArduinoJson for serialization and provides the abstract classes [SettingsSerializer.h](lib/framework/SettingsSerializer.h) and [SettingsDeserializer.h](lib/framework/SettingsDeserializer.h) to facilitate the seriliaztion of settings:
394+
When transmitting settings over HTTP, WebSockets, or MQTT they must to be marshalled into a serializable form. The framework uses ArduinoJson for serialization and provides the abstract classes [SettingsSerializer.h](lib/framework/SettingsSerializer.h) and [SettingsDeserializer.h](lib/framework/SettingsDeserializer.h) to facilitate the serialization of settings:
395395

396396
```cpp
397397
class LightSettingsSerializer : public SettingsSerializer<LightSettings> {
@@ -411,7 +411,7 @@ class LightSettingsDeserializer : public SettingsDeserializer<LightSettings> {
411411
};
412412
```
413413
414-
It is recommended you make create singletons for your serialzers and that they are stateless:
414+
Unless you have more complicated requirements most serializers/deserializers are easiest to implement as stateless singletons:
415415
416416
```cpp
417417
static LightSettingsSerializer SERIALIZER;
@@ -513,7 +513,7 @@ The demo project allows the user to modify the MQTT topics via the UI so they ca
513513

514514
The framework has security features to prevent unauthorized use of the device. This is driven by [SecurityManager.h](lib/framework/SecurityManager.h).
515515

516-
On successful authentication, the /rest/signIn endpoint issues a JWT which is then sent using Bearer Authentication. The framework come with built-in predicates for verifying a users access privileges. The built in AuthenticationPredicates can be found in [SecurityManager.h](lib/framework/SecurityManager.h) and are as follows:
516+
On successful authentication, the /rest/signIn endpoint issues a [JSON Web Token (JWT)](https://jwt.io/) which is then sent using Bearer Authentication. The framework come with built-in predicates for verifying a users access privileges. The built in AuthenticationPredicates can be found in [SecurityManager.h](lib/framework/SecurityManager.h) and are as follows:
517517

518518
Predicate | Description
519519
-------------------- | -----------

lib/framework/SettingsEndpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class SettingsEndpoint {
7979
request->onDisconnect([this]() { _settingsService->callUpdateHandlers(SETTINGS_ENDPOINT_ORIGIN_ID); });
8080

8181
// update the settings, deferring the call to the update handlers to when the response is complete
82-
_settingsService->updateWithoutPropogation([&](T& settings) {
82+
_settingsService->updateWithoutPropagation([&](T& settings) {
8383
_settingsDeserializer->deserialize(settings, json.as<JsonObject>());
8484
_settingsSerializer->serialize(settings, response->getRoot().as<JsonObject>());
8585
});

lib/framework/SettingsService.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ class SettingsService {
4141

4242
void removeUpdateHandler(update_handler_id_t id) {
4343
for (auto i = _settingsUpdateHandlers.begin(); i != _settingsUpdateHandlers.end();) {
44-
if ((*i)._id == id) {
44+
if ((*i)._allowRemove && (*i)._id == id) {
4545
i = _settingsUpdateHandlers.erase(i);
4646
} else {
4747
++i;
4848
}
4949
}
5050
}
5151

52-
void updateWithoutPropogation(std::function<void(T&)> callback) {
52+
void updateWithoutPropagation(std::function<void(T&)> callback) {
5353
read(callback);
5454
}
5555

0 commit comments

Comments
 (0)