webui fix and serverinfo (#699)

* initial commit of webconfig

* update example config with webconfig and fix format of file
update debian postinst script for install example config

* fix compiling
add new web server command "serverinfo" to use in webapp to retrieve json port

* change web default port to 8099
This commit is contained in:
redPanther
2016-06-13 22:54:08 +02:00
committed by brindosch
parent f0884ec25b
commit eb64e7e528
7 changed files with 74 additions and 46 deletions

View File

@@ -195,11 +195,7 @@ 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;
@@ -230,24 +226,6 @@ 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();
@@ -522,11 +500,10 @@ 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);
#ifdef ENABLE_QT5
WebConfig webConfig(config, &app);
#endif
// ---- grabber -----