more fixes - Refactor MQTT subscriptions #173

This commit is contained in:
proddy
2021-11-02 18:15:57 +01:00
parent 131b936a69
commit e1419edb15
6 changed files with 55 additions and 18 deletions

View File

@@ -62,13 +62,8 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
auto method = request->method();
bool authenticated = false;
if (method == HTTP_GET) {
// special case if there is no command, then default to 'list' which is like info but showing short names
if (!input.size()) {
input["cmd"] = "list";
}
} else {
// if its a POST then check authentication
// if its a POST then check authentication
if (method != HTTP_GET) {
EMSESP::webSettingsService.read([&](WebSettings & settings) {
Authentication authentication = _securityManager->authenticateRequest(request);
authenticated = settings.notoken_api | AuthenticationPredicates::IS_ADMIN(authentication);