mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
remove obsolete reference to JsonObject
This commit is contained in:
@@ -75,10 +75,10 @@ class DummySettings {
|
||||
bool enableCORS = false;
|
||||
String CORSOrigin = "*";
|
||||
|
||||
static void read(DummySettings & settings, JsonObject & root){};
|
||||
static void read(DummySettings & settings, JsonObject root){};
|
||||
static void read(DummySettings & settings){};
|
||||
|
||||
static StateUpdateResult update(JsonObject & root, DummySettings & settings) {
|
||||
static StateUpdateResult update(JsonObject root, DummySettings & settings) {
|
||||
return StateUpdateResult::CHANGED;
|
||||
}
|
||||
};
|
||||
@@ -152,7 +152,7 @@ class EMSESPSettingsService {
|
||||
|
||||
class JsonUtils {
|
||||
public:
|
||||
static void writeIP(JsonObject & root, const String & key, const String & ip) {
|
||||
static void writeIP(JsonObject root, const String & key, const String & ip) {
|
||||
root[key] = ip;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,12 +62,12 @@ Authentication SecuritySettingsService::authenticate(const String & username, co
|
||||
return Authentication();
|
||||
}
|
||||
|
||||
inline void populateJWTPayload(JsonObject & payload, User * user) {
|
||||
inline void populateJWTPayload(JsonObject payload, User * user) {
|
||||
payload["username"] = user->username;
|
||||
payload["admin"] = user->admin;
|
||||
}
|
||||
|
||||
boolean SecuritySettingsService::validatePayload(JsonObject & parsedPayload, User * user) {
|
||||
boolean SecuritySettingsService::validatePayload(JsonObject parsedPayload, User * user) {
|
||||
JsonDocument jsonDocument;
|
||||
JsonObject payload = jsonDocument.to<JsonObject>();
|
||||
populateJWTPayload(payload, user);
|
||||
|
||||
@@ -32,7 +32,7 @@ class SecuritySettings {
|
||||
String jwtSecret;
|
||||
std::list<User> users;
|
||||
|
||||
static void read(SecuritySettings & settings, JsonObject & root) {
|
||||
static void read(SecuritySettings & settings, JsonObject root) {
|
||||
// secret
|
||||
root["jwt_secret"] = settings.jwtSecret;
|
||||
|
||||
@@ -46,7 +46,7 @@ class SecuritySettings {
|
||||
}
|
||||
}
|
||||
|
||||
static StateUpdateResult update(JsonObject & root, SecuritySettings & settings) {
|
||||
static StateUpdateResult update(JsonObject root, SecuritySettings & settings) {
|
||||
// secret
|
||||
settings.jwtSecret = root["jwt_secret"] | FACTORY_JWT_SECRET;
|
||||
|
||||
@@ -85,7 +85,7 @@ class SecuritySettingsService : public StatefulService<SecuritySettings>, public
|
||||
|
||||
void configureJWTHandler();
|
||||
Authentication authenticateJWT(String & jwt);
|
||||
boolean validatePayload(JsonObject & parsedPayload, User * user);
|
||||
boolean validatePayload(JsonObject parsedPayload, User * user);
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
@@ -15,10 +15,10 @@ enum class StateUpdateResult {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using JsonStateUpdater = std::function<StateUpdateResult(JsonObject & root, T & settings)>;
|
||||
using JsonStateUpdater = std::function<StateUpdateResult(JsonObject root, T & settings)>;
|
||||
|
||||
template <typename T>
|
||||
using JsonStateReader = std::function<void(T & settings, JsonObject & root)>;
|
||||
using JsonStateReader = std::function<void(T & settings, JsonObject root)>;
|
||||
|
||||
typedef size_t update_handler_id_t;
|
||||
typedef std::function<void(const String & originId)> StateUpdateCallback;
|
||||
@@ -85,7 +85,7 @@ class StatefulService {
|
||||
return result;
|
||||
}
|
||||
|
||||
StateUpdateResult update(JsonObject & jsonObject, JsonStateUpdater<T> stateUpdater, const String & originId) {
|
||||
StateUpdateResult update(JsonObject jsonObject, JsonStateUpdater<T> stateUpdater, const String & originId) {
|
||||
beginTransaction();
|
||||
StateUpdateResult result = stateUpdater(jsonObject, _state);
|
||||
endTransaction();
|
||||
@@ -95,7 +95,7 @@ class StatefulService {
|
||||
return result;
|
||||
}
|
||||
|
||||
StateUpdateResult updateWithoutPropagation(JsonObject & jsonObject, JsonStateUpdater<T> stateUpdater) {
|
||||
StateUpdateResult updateWithoutPropagation(JsonObject jsonObject, JsonStateUpdater<T> stateUpdater) {
|
||||
beginTransaction();
|
||||
StateUpdateResult result = stateUpdater(jsonObject, _state);
|
||||
endTransaction();
|
||||
@@ -108,7 +108,7 @@ class StatefulService {
|
||||
endTransaction();
|
||||
}
|
||||
|
||||
void read(JsonObject & jsonObject, JsonStateReader<T> stateReader) {
|
||||
void read(JsonObject jsonObject, JsonStateReader<T> stateReader) {
|
||||
beginTransaction();
|
||||
stateReader(_state, jsonObject);
|
||||
endTransaction();
|
||||
|
||||
Reference in New Issue
Block a user