29 const QString &sApplicationPrefix)
31 m_indexFilename(sApplicationPrefix +
"index")
34 LOG(VB_HTTP, LOG_INFO, QString(
"HtmlServerExtension() - SharePath = %1")
65 bool bStorageGroupFile =
false;
73 oInfo.setFile( sIndexFileName );
86 bStorageGroupFile =
true;
90 if (bStorageGroupFile || oInfo.exists() )
92 QString sResName = oInfo.canonicalFilePath();
98 if (( bStorageGroupFile ) ||
99 (sResName.startsWith(
m_sSharePath, Qt::CaseInsensitive )))
103 if (oInfo.isSymLink())
104 sResName = oInfo.symLinkTarget();
109 QByteArray cspNonce = QUuid::createUuid().toByteArray().toBase64();
110 cspNonce = cspNonce.mid(1, cspNonce.length() - 2);
116 QString sSuffix = oInfo.suffix().toLower();
120 if (sMimeType ==
"text/html")
122 else if (sMimeType ==
"text/xml")
124 else if (sMimeType ==
"application/javascript")
126 else if (sMimeType ==
"text/css")
128 else if (sMimeType ==
"text/plain")
130 else if (sMimeType ==
"image/svg+xml" &&
173 QString cspPolicy =
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://services.mythtv.org; "
174 "style-src 'self' 'unsafe-inline'; "
176 "object-src 'self'; "
180 "form-action 'self'; "
181 "frame-ancestors 'self'; ";
192 if ((sSuffix ==
"qsp") ||
193 (sSuffix ==
"qxml") ||
199 m_scripting.EvaluatePage( &stream, sResName, pRequest, cspNonce);
QByteArray GetResponsePage(void)
HttpResponseType m_eResponseType
void FormatFileResponse(const QString &sFileName)
static QString GetMimeType(const QString &sFileExtension)
void SetResponseHeader(const QString &sKey, const QString &sValue, bool replace=false)
bool ProcessRequest(HTTPRequest *pRequest) override
HtmlServerExtension(const QString &sSharePath, const QString &sApplicationPrefix)
QString FindFile(const QString &filename)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)