mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Read-Only Configuration-Database support (#1046)
This commit is contained in:
@@ -378,11 +378,18 @@ QString API::saveEffect(const QJsonObject &data)
|
||||
return NO_AUTH;
|
||||
}
|
||||
|
||||
void API::saveSettings(const QJsonObject &data)
|
||||
bool API::saveSettings(const QJsonObject &data)
|
||||
{
|
||||
bool rc = true;
|
||||
if (!_adminAuthorized)
|
||||
return;
|
||||
QMetaObject::invokeMethod(_hyperion, "saveSettings", Qt::QueuedConnection, Q_ARG(QJsonObject, data), Q_ARG(bool, true));
|
||||
{
|
||||
rc = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMetaObject::invokeMethod(_hyperion, "saveSettings", Qt::DirectConnection, Q_RETURN_ARG(bool, rc), Q_ARG(QJsonObject, data), Q_ARG(bool, true));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool API::updateHyperionPassword(const QString &password, const QString &newPassword)
|
||||
|
@@ -293,6 +293,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command,
|
||||
hyperion["gitremote"] = QString(HYPERION_GIT_REMOTE);
|
||||
hyperion["time"] = QString(__DATE__ " " __TIME__);
|
||||
hyperion["id"] = _authManager->getID();
|
||||
hyperion["readOnlyMode"] = _hyperion->getReadOnlyMode();
|
||||
|
||||
info["hyperion"] = hyperion;
|
||||
|
||||
@@ -875,8 +876,14 @@ void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &
|
||||
QJsonObject config = message["config"].toObject();
|
||||
if (API::isHyperionEnabled())
|
||||
{
|
||||
API::saveSettings(config);
|
||||
sendSuccessReply(command, tan);
|
||||
if ( API::saveSettings(config) )
|
||||
{
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendErrorReply("Save settings failed", command, tan);
|
||||
}
|
||||
}
|
||||
else
|
||||
sendErrorReply("Saving configuration while Hyperion is disabled isn't possible", command, tan);
|
||||
|
Reference in New Issue
Block a user