mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-19 09:40:11 +02:00
dont assume no query tags
This commit is contained in:
parent
cc81bcab66
commit
8749428ede
4 changed files with 16 additions and 9 deletions
|
@ -18,5 +18,5 @@ WebView {
|
|||
storageName: "qmlWebEngine"
|
||||
}
|
||||
|
||||
urlTag: "?noDownload=true";
|
||||
urlTag: "noDownload=true";
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ Item {
|
|||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
property string urlTag: "?noDownload=false";
|
||||
property string urlTag: "noDownload=false";
|
||||
|
||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
||||
|
||||
|
@ -98,7 +98,8 @@ Item {
|
|||
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
var url = loadRequest.url.toString() + urlTag;
|
||||
var url = loadRequest.url.toString();
|
||||
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
||||
if (urlHandler.canHandleUrl(url)) {
|
||||
if (urlHandler.handleUrl(url)) {
|
||||
root.stop();
|
||||
|
|
|
@ -219,7 +219,7 @@ static const QString FST_EXTENSION = ".fst";
|
|||
static const QString FBX_EXTENSION = ".fbx";
|
||||
static const QString OBJ_EXTENSION = ".obj";
|
||||
static const QString AVA_JSON_EXTENSION = ".ava.json";
|
||||
static const QString WEB_VIEW_TAG = "?noDownload=true";
|
||||
static const QString WEB_VIEW_TAG = "noDownload=true";
|
||||
|
||||
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
|
||||
|
||||
|
@ -2608,7 +2608,7 @@ bool Application::event(QEvent* event) {
|
|||
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
|
||||
|
||||
QUrl url = fileEvent->url();
|
||||
|
||||
|
||||
if (!url.isEmpty()) {
|
||||
QString urlString = url.toString();
|
||||
|
||||
|
@ -5548,7 +5548,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
|
||||
bool Application::canAcceptURL(const QString& urlString) const {
|
||||
QUrl url(urlString);
|
||||
if (urlString.endsWith(WEB_VIEW_TAG)) {
|
||||
if (url.query().contains(WEB_VIEW_TAG)) {
|
||||
return false;
|
||||
} else if (urlString.startsWith(HIFI_URL_SCHEME)) {
|
||||
return true;
|
||||
|
@ -5658,7 +5658,9 @@ bool Application::askToLoadScript(const QString& scriptFilenameOrURL) {
|
|||
QUrl scriptURL { scriptFilenameOrURL };
|
||||
|
||||
if (scriptURL.host().endsWith(MARKETPLACE_CDN_HOSTNAME)) {
|
||||
shortName = shortName.mid(shortName.lastIndexOf('/') + 1);
|
||||
int startIndex = shortName.lastIndexOf('/') + 1;
|
||||
int endIndex = shortName.lastIndexOf('?');
|
||||
shortName = shortName.mid(startIndex, endIndex - startIndex);
|
||||
}
|
||||
|
||||
QString message = "Would you like to run this script:\n" + shortName;
|
||||
|
|
|
@ -31,7 +31,11 @@ namespace {
|
|||
}
|
||||
|
||||
bool isScript(const QString filename) {
|
||||
return filename.contains(".js", Qt::CaseInsensitive);
|
||||
return filename.endsWith(".js", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool isJSON(const QString filename) {
|
||||
return filename.endsWith(".json", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,7 +57,7 @@ void RequestFilters::interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info)
|
|||
|
||||
void RequestFilters::interceptFileType(QWebEngineUrlRequestInfo& info) {
|
||||
QString filename = info.requestUrl().fileName();
|
||||
if (isScript(filename)) {
|
||||
if (isScript(filename) || isJSON(filename)) {
|
||||
static const QString CONTENT_HEADER = "Accept";
|
||||
static const QString TYPE_VALUE = "text/plain,text/html";
|
||||
info.setHttpHeader(CONTENT_HEADER.toLocal8Bit(), TYPE_VALUE.toLocal8Bit());
|
||||
|
|
Loading…
Reference in a new issue