mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
integrated webserver ... (#697)
* initial commit of webconfig * update example config with webconfig and fix format of file update debian postinst script for install example config
This commit is contained in:
@@ -9,8 +9,11 @@ target_link_libraries(hyperiond
|
||||
effectengine
|
||||
jsonserver
|
||||
boblightserver
|
||||
protoserver
|
||||
protoserver
|
||||
)
|
||||
if (ENABLE_QT5)
|
||||
target_link_libraries(hyperiond webconfig)
|
||||
endif ()
|
||||
|
||||
if (ENABLE_DISPMANX)
|
||||
target_link_libraries(hyperiond dispmanx-grabber)
|
||||
@@ -40,4 +43,4 @@ install ( TARGETS hyperiond DESTINATION "bin" COMPONENT ambilight )
|
||||
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/effects DESTINATION "share/hyperion/" COMPONENT ambilight )
|
||||
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT ambilight )
|
||||
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/config DESTINATION "share/hyperion/" COMPONENT ambilight )
|
||||
|
||||
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/assets/webconfig DESTINATION "share/hyperion/" COMPONENT ambilight )
|
||||
|
@@ -58,8 +58,16 @@
|
||||
#include <QHostInfo>
|
||||
#endif
|
||||
|
||||
// JsonServer includes
|
||||
// network servers
|
||||
#include <jsonserver/JsonServer.h>
|
||||
#include <protoserver/ProtoServer.h>
|
||||
#include <boblightserver/BoblightServer.h>
|
||||
#include <webconfig/WebConfig.h>
|
||||
|
||||
#include <sys/prctl.h>
|
||||
#include <utils/logger.h>
|
||||
|
||||
using namespace vlofgren;
|
||||
|
||||
// ProtoServer includes
|
||||
#include <protoserver/ProtoServer.h>
|
||||
@@ -187,7 +195,11 @@ void startXBMCVideoChecker(const Json::Value &config, XBMCVideoChecker* &xbmcVid
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_QT5
|
||||
void startNetworkServices(const Json::Value &config, Hyperion &hyperion, JsonServer* &jsonServer, ProtoServer* &protoServer, BoblightServer* &boblightServer, WebConfig* &webConfig, XBMCVideoChecker* &xbmcVideoChecker, QObject* parent)
|
||||
#else
|
||||
void startNetworkServices(const Json::Value &config, Hyperion &hyperion, JsonServer* &jsonServer, ProtoServer* &protoServer, BoblightServer* &boblightServer, XBMCVideoChecker* &xbmcVideoChecker)
|
||||
#endif
|
||||
{
|
||||
// Create Json server if configuration is present
|
||||
unsigned int jsonPort = 19444;
|
||||
@@ -218,6 +230,24 @@ void startNetworkServices(const Json::Value &config, Hyperion &hyperion, JsonSer
|
||||
}
|
||||
std::cout << "INFO: Proto server created and started on port " << protoServer->getPort() << std::endl;
|
||||
|
||||
#ifdef ENABLE_QT5
|
||||
// webconfig server
|
||||
std::string webconfigPath = "/usr/share/hyperion/webconfig";
|
||||
quint16 webconfigPort = 80;
|
||||
bool webconfigEnable = true;
|
||||
if (config.isMember("webConfig"))
|
||||
{
|
||||
const Json::Value & webconfigConfig = config["webConfig"];
|
||||
webconfigEnable = webconfigConfig.get("enable", true).asBool();
|
||||
webconfigPort = webconfigConfig.get("port", 80).asUInt();
|
||||
webconfigPath = webconfigConfig.get("document_root", "/usr/share/hyperion/webconfig").asString();
|
||||
}
|
||||
|
||||
webConfig = new WebConfig(webconfigPath, webconfigPort, parent);
|
||||
if ( webconfigEnable )
|
||||
webConfig->start();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_ZEROCONF
|
||||
const Json::Value & deviceConfig = config["device"];
|
||||
const std::string deviceName = deviceConfig.get("name", "").asString();
|
||||
@@ -492,7 +522,12 @@ int main(int argc, char** argv)
|
||||
JsonServer * jsonServer = nullptr;
|
||||
ProtoServer * protoServer = nullptr;
|
||||
BoblightServer * boblightServer = nullptr;
|
||||
#ifdef ENABLE_QT5
|
||||
WebConfig * webConfig = nullptr;
|
||||
startNetworkServices(config, hyperion, jsonServer, protoServer, boblightServer, webConfig, xbmcVideoChecker, &app);
|
||||
#else
|
||||
startNetworkServices(config, hyperion, jsonServer, protoServer, boblightServer, xbmcVideoChecker);
|
||||
#endif
|
||||
|
||||
// ---- grabber -----
|
||||
|
||||
|
Reference in New Issue
Block a user