mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 11:35:20 +02:00
check scripts
This commit is contained in:
parent
9d0667cb31
commit
3b88553699
1 changed files with 3 additions and 7 deletions
|
@ -24,14 +24,10 @@ bool static isAuthableHighFidelityURL(const QUrl& url) {
|
|||
return url.scheme() == "https" && HF_HOSTS.contains(url.host());
|
||||
}
|
||||
|
||||
bool static isJavaScriptFile(const QString filename) {
|
||||
bool static isScript(const QString filename) {
|
||||
return filename.contains(".js", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool static isEntityFile(const QString filename) {
|
||||
return filename.contains(".svo.json", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
void RequestFilters::interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info) {
|
||||
// check if this is a request to a highfidelity URL
|
||||
if (isAuthableHighFidelityURL(info.requestUrl())) {
|
||||
|
@ -49,9 +45,9 @@ void RequestFilters::interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info)
|
|||
|
||||
void RequestFilters::interceptFileType(QWebEngineUrlRequestInfo& info) {
|
||||
QString filename = info.requestUrl().fileName();
|
||||
if (isJavaScriptFile(filename) || isEntityFile(filename)) {
|
||||
if (isScript(filename)) {
|
||||
static const QString CONTENT_HEADER = "Accept";
|
||||
static const QString TYPE_VALUE = "text/plain";
|
||||
static const QString TYPE_VALUE = "text/plain,text/html";
|
||||
info.setHttpHeader(CONTENT_HEADER.toLocal8Bit(), TYPE_VALUE.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue