diff options
author | thlo <smarttv640@gmail.com> | 2013-09-01 21:09:15 +0200 |
---|---|---|
committer | thlo <smarttv640@gmail.com> | 2013-09-01 21:09:15 +0200 |
commit | 417202343b64947e80dbe14b4ab456cc6442e88c (patch) | |
tree | 1e73bb20f1ac91725dfd1e0f124c419c1fe7a391 | |
parent | 752587bccad186db28df673f84690eb265ecd991 (diff) | |
download | vdr-plugin-smarttvweb-417202343b64947e80dbe14b4ab456cc6442e88c.tar.gz vdr-plugin-smarttvweb-417202343b64947e80dbe14b4ab456cc6442e88c.tar.bz2 |
New enable flag for RecCmds and new Port parameter in smarttvweb.conf. Bug fixes.
-rw-r--r-- | httpclient.c | 3 | ||||
-rwxr-xr-x | httpresource.c | 19 | ||||
-rwxr-xr-x | responsememblk.c | 9 | ||||
-rwxr-xr-x | smarttvfactory.c | 9 | ||||
-rw-r--r-- | smarttvweb.conf | 5 | ||||
-rwxr-xr-x | stvw_cfg.c | 14 | ||||
-rwxr-xr-x | stvw_cfg.h | 4 |
7 files changed, 55 insertions, 8 deletions
diff --git a/httpclient.c b/httpclient.c index a3fb192..722a659 100644 --- a/httpclient.c +++ b/httpclient.c @@ -364,7 +364,6 @@ string cHttpYtPushClient::getMsgBody(int) { //------------------------------ cHttpCfgPushClient::cHttpCfgPushClient(int f, int id, int port, SmartTvServer* fac, string peer) : cHttpClientBase(f, id, port, fac, peer) { - createRequestMessage(""); } @@ -403,5 +402,5 @@ cHttpMesgPushClient::~cHttpMesgPushClient() { } string cHttpMesgPushClient::getMsgBody(int) { - return "{\"type\":\"MESG\",payload:" + mMesg +"}";; + return "{\"type\":\"MESG\",payload:\"" + mMesg +"\"}";; } diff --git a/httpresource.c b/httpresource.c index fcb7f82..24645bf 100755 --- a/httpresource.c +++ b/httpresource.c @@ -352,6 +352,14 @@ int cHttpResource::processRequest() { } //thlo for testing purpose +/* + if (mPath.compare("/modifyTimer") == 0) { + mResponse = new cResponseMemBlk(this); + ((cResponseMemBlk*)mResponse)->receiveModTimerReq(); + return OKAY; + } +*/ + //thlo for testing purpose if (mPath.compare("/addTimer") == 0) { mResponse = new cResponseMemBlk(this); ((cResponseMemBlk*)mResponse)->receiveAddTimerReq(); @@ -453,13 +461,22 @@ int cHttpResource::processRequest() { } } - if (mPath.find("/web/") == 0) { + if (mPath.find("/web/", 0, 5) == 0) { mPath = mFactory->getConfigDir() + mPath; *(mLog->log())<< DEBUGPREFIX << " Found web request. serving " << mPath << endl; ok_to_serve = true; } + if (mPath.find("/live/", 0, 6) == 0) { + *(mLog->log())<< DEBUGPREFIX + << " Found live request. serving " << mPath << endl; + //mResponse = new cResponseLive(this, mPath.substr(6)); + //((cResponseVdrDir*)mResponse)->sendMediaSegment( &statbuf); + return OKAY; + + } + if (mPath.compare(0, strlen(VideoDirectory), VideoDirectory) == 0) { *(mLog->log())<< DEBUGPREFIX << " Found video dir request. serving " << mPath << endl; diff --git a/responsememblk.c b/responsememblk.c index f77f950..292dabb 100755 --- a/responsememblk.c +++ b/responsememblk.c @@ -1172,7 +1172,6 @@ void cResponseMemBlk::sendRecCmds() { void cResponseMemBlk::receiveExecRecCmdReq() { vector<sQueryAVP> avps; - mRequest->parseQueryLine(&avps); string guid; string cmd_str; uint cmdid; @@ -1180,6 +1179,14 @@ void cResponseMemBlk::receiveExecRecCmdReq() { if (isHeadRequest()) return; + if (! mRequest->mFactory->getConfig()->getRecCmds()) { + sendError(400, "Bad Request", NULL, "017 execreccmd disabled."); + return; + + } + mRequest->parseQueryLine(&avps); + + if (mRequest->getQueryAttributeValue(&avps, "guid", guid) != OKAY){ sendError(400, "Bad Request", NULL, "002 No guid in query line"); return; diff --git a/smarttvfactory.c b/smarttvfactory.c index b281a61..94242e6 100755 --- a/smarttvfactory.c +++ b/smarttvfactory.c @@ -713,9 +713,14 @@ void SmartTvServer::initServer(string dir) { #ifndef STANDALONE mConfig = new cSmartTvConfig(dir); + serverPort = mConfig->getServerPort(); mLog.init(mConfig->getLogFile()); - esyslog("SmartTvWeb: Logfile created"); - + + if (mConfig->getLogFile() != "") { + string msg = "SmartTvWeb: Logfile created File= " + mConfig->getLogFile(); + // esyslog("SmartTvWeb: Logfile created"); + esyslog(msg.c_str()); + } *(mLog.log()) << "LogFile= " << mConfig->getLogFile() << endl; initRecCmds(); diff --git a/smarttvweb.conf b/smarttvweb.conf index 07920dc..10adaa7 100644 --- a/smarttvweb.conf +++ b/smarttvweb.conf @@ -26,3 +26,8 @@ GroupSeparators Ignore # Bind the web server to a specific IP address. Otherwise, the Web Server is listening on ALL interfaces. #ServerAddress 127.0.0.1 +# Bind the web server to a specific port. Default is Port 8000. +#ServerPort 8000 + +# Allow execution of reccmd.conf defined programs through the widget. Ensure that only authorized hosts get access to the plugin (e.g. firewall protected). +#RecCmds enable @@ -33,7 +33,7 @@ cSmartTvConfig::cSmartTvConfig(string d): mConfigDir(d), mLog(NULL), mCfgFile(NULL), mLogFile(), mMediaFolder(), mSegmentDuration(), mHasMinBufferTime(), mHasBitrateCorrection(), - mLiveChannels(), mGroupSep(IGNORE), mServerAddress("") { + mLiveChannels(), mGroupSep(IGNORE), mServerAddress(""), mServerPort(8000), mRecCmds(false) { #ifndef STANDALONE mLogFile= ""; @@ -140,7 +140,17 @@ void cSmartTvConfig::readConfig() { if (strcmp(attr, "ServerAddress") == 0) { mServerAddress = value; - // cout << " Found mLiveChannels= " <<mLiveChannels << endl; + continue; + } + + if (strcmp(attr, "ServerPort") == 0) { + mServerPort = atoi(value); + continue; + } + + if (strcmp(attr, "RecCmds") == 0) { + if (strcmp(value, "enable") == 0) + mRecCmds = true; continue; } @@ -54,6 +54,8 @@ class cSmartTvConfig { eGroupSep mGroupSep; string mServerAddress; + int mServerPort; + bool mRecCmds; public: cSmartTvConfig(string dir); @@ -70,6 +72,8 @@ class cSmartTvConfig { int getLiveChannels() {return mLiveChannels; }; eGroupSep getGroupSep() { return mGroupSep; }; string getServerAddress() { return mServerAddress; }; + int getServerPort() { return mServerPort; }; + bool getRecCmds() { return mRecCmds; }; }; #endif |