mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
move write config from json api to http post (#363)
* implement config save over http post instead of json * remove json set config finish config write thrugh http post * remove debug code and add failure messages
This commit is contained in:
@@ -967,10 +967,6 @@ void JsonClientConnection::handleConfigCommand(const QJsonObject& message, const
|
||||
{
|
||||
handleConfigGetCommand(message, full_command, tan);
|
||||
}
|
||||
else if (subcommand == "setconfig")
|
||||
{
|
||||
handleConfigSetCommand(message, full_command, tan);
|
||||
}
|
||||
else if (subcommand == "reload")
|
||||
{
|
||||
_hyperion->freeObjects();
|
||||
@@ -1098,28 +1094,6 @@ void JsonClientConnection::handleSchemaGetCommand(const QJsonObject& message, co
|
||||
sendMessage(result);
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleConfigSetCommand(const QJsonObject& message, const QString &command, const int tan)
|
||||
{
|
||||
if(message.size() > 0)
|
||||
{
|
||||
if (message.contains("config"))
|
||||
{
|
||||
QString errors;
|
||||
if (!checkJson(message["config"].toObject(), ":/hyperion-schema", errors, true))
|
||||
{
|
||||
sendErrorReply("Error while validating json: " + errors, command, tan);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject hyperionConfig = message["config"].toObject();
|
||||
QJsonFactory::writeJson(QString::fromStdString(_hyperion->getConfigFileName()), hyperionConfig);
|
||||
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
} else
|
||||
sendErrorReply("Error while parsing json: Message size " + QString(message.size()), command, tan);
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleComponentStateCommand(const QJsonObject& message, const QString &command, const int tan)
|
||||
{
|
||||
const QJsonObject & componentState = message["componentstate"].toObject();
|
||||
|
@@ -234,11 +234,6 @@ private:
|
||||
///
|
||||
void handleConfigGetCommand(const QJsonObject & message, const QString &command, const int tan);
|
||||
|
||||
///
|
||||
/// Handle an incoming JSON SetConfig message
|
||||
///
|
||||
void handleConfigSetCommand(const QJsonObject & message, const QString &command, const int tan);
|
||||
|
||||
///
|
||||
/// Handle an incoming JSON Component State message
|
||||
///
|
||||
|
@@ -10,7 +10,7 @@
|
||||
"subcommand": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["getconfig","setconfig","getschema","reload"]
|
||||
"enum" : ["getconfig","getschema","reload"]
|
||||
},
|
||||
"tan" : {
|
||||
"type" : "integer"
|
||||
|
Reference in New Issue
Block a user