15 #include <QTextStream>
31 const QString &sApplicationPrefix)
33 m_indexFilename(sApplicationPrefix +
"index")
36 LOG(VB_HTTP, LOG_INFO, QString(
"HtmlServerExtension() - SharePath = %1")
45 QScriptEngine *pEngine = ScriptEngine();
46 pEngine->globalObject().setProperty(
"Rtti",
47 pEngine->scriptValueFromQMetaObject< ScriptableRtti >() );
76 bool bStorageGroupFile =
false;
84 oInfo.setFile( sIndexFileName );
97 bStorageGroupFile =
true;
101 if (bStorageGroupFile || oInfo.exists() )
103 QString sResName = oInfo.canonicalFilePath();
109 if (( bStorageGroupFile ) ||
110 (sResName.startsWith(
m_sSharePath, Qt::CaseInsensitive )))
114 if (oInfo.isSymLink())
115 sResName = oInfo.symLinkTarget();
120 QByteArray cspNonce = QUuid::createUuid().toByteArray().toBase64();
121 cspNonce = cspNonce.mid(1, cspNonce.length() - 2);
127 QString sSuffix = oInfo.suffix().toLower();
131 if (sMimeType ==
"text/html")
133 else if (sMimeType ==
"text/xml")
135 else if (sMimeType ==
"application/javascript")
137 else if (sMimeType ==
"text/css")
139 else if (sMimeType ==
"text/plain")
141 else if (sMimeType ==
"image/svg+xml" &&
184 QString cspPolicy =
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://services.mythtv.org; "
185 "style-src 'self' 'unsafe-inline'; "
187 "object-src 'self'; "
191 "form-action 'self'; "
192 "frame-ancestors 'self'; ";
203 if ((sSuffix ==
"qsp") ||
204 (sSuffix ==
"qxml") ||
210 m_scripting.EvaluatePage( &stream, sResName, pRequest, cspNonce);