From f7707bb2d0a9cd3a37da46daf31c147cdd9020da Mon Sep 17 00:00:00 2001 From: Paulchen-Panther Date: Sat, 20 Jul 2019 14:59:31 +0200 Subject: [PATCH] Append led array to JsonAPI ServerInfo Signed-off-by: Paulchen-Panther --- CompileHowto.md | 2 +- libsrc/api/JsonAPI.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CompileHowto.md b/CompileHowto.md index 983df2d1..1b6e0a8b 100644 --- a/CompileHowto.md +++ b/CompileHowto.md @@ -1,7 +1,7 @@ # With Docker If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compiling for Raspberry Pi (Debian Stretch or higher). To compile Hyperion just execute one of the following commands. -The compiled binaries and packages will be available at the deploy folder next to the script +The compiled binaries and packages will be available at the deploy folder next to the script.
Note: call the script with `./docker-compile.sh -h` for more options ## Native compiling on Raspberry Pi diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index b62a1850..cea4f3a1 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -565,6 +565,9 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject& message, const QString& } info["instance"] = instanceInfo; + // add leds configs + info["leds"] = _hyperion->getSetting(settings::LEDS).array(); + // BEGIN | The following entries are derecated but used to ensure backward compatibility with hyperion Classic remote control // TODO Output the real transformation information instead of default @@ -683,7 +686,8 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject& message, const QString& } for(const auto & entry : subsArr) { - if(entry == "settings-update") + // config callbacks just if auth is set + if(entry == "settings-update" && !_authorized) continue; if(!_jsonCB->subscribeFor(entry.toString())) @@ -989,6 +993,7 @@ void JsonAPI::handleLedColorsCommand(const QJsonObject& message, const QString & _streaming_image_reply["command"] = command+"-imagestream-update"; _streaming_image_reply["tan"] = tan; connect(_hyperion, &Hyperion::currentImage, this, &JsonAPI::setImage, Qt::UniqueConnection); + _hyperion->update(); } else if (subcommand == "imagestream-stop") { @@ -996,7 +1001,6 @@ void JsonAPI::handleLedColorsCommand(const QJsonObject& message, const QString & } else { - sendErrorReply("unknown subcommand \""+subcommand+"\"",command,tan); return; } @@ -1032,7 +1036,6 @@ void JsonAPI::handleLoggingCommand(const QJsonObject& message, const QString &co } else { - sendErrorReply("unknown subcommand",command,tan); return; } @@ -1142,7 +1145,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject & message, const QString return; } - // accept token request + // accept/deny token request if(subc == "answerRequest") { const QString& id = message["id"].toString().trimmed();