Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the MNV related MythXML methods to include serving up javascri…

…pt-wrapped HTML pages.

Another patch by Jonatan Martens, and completes the set allowing us to natively control flash players where applicable.
  • Loading branch information...
commit 5b7b93d2e6c94f4ba29fc49f445a4bdcf5b54a3b 1 parent 7ac2b5f
Robert McNamara authored
View
32 mythtv/programs/mythbackend/mythxml.cpp
@@ -123,6 +123,7 @@ MythXMLMethod MythXML::GetMethod( const QString &sURI )
if (sURI == "GetVideoArt" ) return MXML_GetVideoArt;
if (sURI == "GetInternetSearch" ) return MXML_GetInternetSearch;
if (sURI == "GetInternetSources" ) return MXML_GetInternetSources;
+ if (sURI == "GetInternetContent" ) return MXML_GetInternetContent;
return MXML_Unknown;
}
@@ -229,6 +230,9 @@ bool MythXML::ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest )
case MXML_GetInternetSources :
GetInternetSources( pRequest );
return true;
+ case MXML_GetInternetContent :
+ GetInternetContent( pRequest );
+ return true;
case MXML_GetConnectionInfo :
GetConnectionInfo( pRequest );
@@ -1662,6 +1666,34 @@ void MythXML::GetInternetSources( HTTPRequest *pRequest )
pRequest->FormatActionResponse( list );
}
+void MythXML::GetInternetContent( HTTPRequest *pRequest )
+{
+ pRequest->m_eResponseType = ResponseTypeHTML;
+
+ QString grabber = pRequest->m_mapParams[ "Grabber" ];
+
+ if (grabber.isEmpty())
+ return;
+
+ QString contentDir = QString("%1internetcontent/").arg(GetShareDir());
+ QString htmlFile(contentDir + grabber);
+
+ // Try to prevent directory traversal
+ QFileInfo fileInfo(htmlFile);
+ if (fileInfo.canonicalFilePath().startsWith(contentDir) &&
+ QFile::exists( htmlFile ))
+ {
+ pRequest->m_eResponseType = ResponseTypeFile;
+ pRequest->m_nResponseStatus = 200;
+ pRequest->m_sFileName = htmlFile;
+ }
+ else
+ {
+ pRequest->FormatRawResponse( QString("<HTML>File %1 does "
+ "not exist!</HTML>").arg(htmlFile) );
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
View
8 mythtv/programs/mythbackend/mythxml.h
@@ -54,10 +54,11 @@ typedef enum
MXML_GetVideoArt = 17,
MXML_GetInternetSearch = 18,
MXML_GetInternetSources = 19,
+ MXML_GetInternetContent = 20,
- MXML_GetFile = 20,
- MXML_GetFileList = 21,
- MXML_GetFileLinks = 22,
+ MXML_GetFile = 21,
+ MXML_GetFileList = 22,
+ MXML_GetFileLinks = 23,
} MythXMLMethod;
@@ -127,6 +128,7 @@ class MythXML : public Eventing
void GetInternetSearch( HTTPRequest *pRequest );
void GetInternetSources( HTTPRequest *pRequest );
+ void GetInternetContent( HTTPRequest *pRequest );
void GetDeviceDesc ( HTTPRequest *pRequest );
void GetFile ( HTTPRequest *pRequest, QString sFileName );
Please sign in to comment.
Something went wrong with that request. Please try again.