mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 06:20:03 +02:00
add url tag to web entities
This commit is contained in:
parent
19ab7526d3
commit
9d0667cb31
7 changed files with 18 additions and 12 deletions
|
@ -17,4 +17,6 @@ WebView {
|
|||
id: webviewProfile
|
||||
storageName: "qmlWebEngine"
|
||||
}
|
||||
|
||||
urlTag: "?noDowload=true";
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ Item {
|
|||
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||
property alias canGoBack: root.canGoBack;
|
||||
property var goBack: root.goBack;
|
||||
property alias urlTag: root.urlTag
|
||||
property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
@ -68,6 +69,8 @@ Item {
|
|||
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
property string urlTag: "?noDowload=false";
|
||||
|
||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
||||
|
||||
|
@ -95,7 +98,7 @@ Item {
|
|||
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
var url = loadRequest.url.toString();
|
||||
var url = loadRequest.url.toString() + urlTag;
|
||||
if (urlHandler.canHandleUrl(url)) {
|
||||
if (urlHandler.handleUrl(url)) {
|
||||
root.stop();
|
||||
|
|
|
@ -219,6 +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 = "?noDowload=true";
|
||||
|
||||
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
|
||||
|
||||
|
@ -2607,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();
|
||||
|
||||
|
@ -5549,6 +5550,8 @@ bool Application::canAcceptURL(const QString& urlString) const {
|
|||
QUrl url(urlString);
|
||||
if (urlString.startsWith(HIFI_URL_SCHEME)) {
|
||||
return true;
|
||||
} else if (urlString.endsWith(WEB_VIEW_TAG)) {
|
||||
return false;
|
||||
}
|
||||
QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions);
|
||||
QString lowerPath = url.path().toLower();
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "RequestFilters.h"
|
||||
|
||||
void FileTypeRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
|
||||
RequestFilters* filter = new RequestFilters;
|
||||
filter->interceptHFWebEngineRequest(info);
|
||||
filter->interceptFileType(info);
|
||||
RequestFilters::interceptHFWebEngineRequest(info);
|
||||
RequestFilters::interceptFileType(info);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,5 @@
|
|||
#include "RequestFilters.h"
|
||||
|
||||
void HFWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
|
||||
RequestFilters* filter = new RequestFilters;
|
||||
filter->interceptHFWebEngineRequest(info);
|
||||
RequestFilters::interceptHFWebEngineRequest(info);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <AccountManager.h>
|
||||
|
||||
bool isAuthableHighFidelityURL(const QUrl& url) {
|
||||
bool static isAuthableHighFidelityURL(const QUrl& url) {
|
||||
static const QStringList HF_HOSTS = {
|
||||
"highfidelity.com", "highfidelity.io",
|
||||
"metaverse.highfidelity.com", "metaverse.highfidelity.io"
|
||||
|
@ -24,11 +24,11 @@ bool isAuthableHighFidelityURL(const QUrl& url) {
|
|||
return url.scheme() == "https" && HF_HOSTS.contains(url.host());
|
||||
}
|
||||
|
||||
bool isJavaScriptFile(const QString filename) {
|
||||
bool static isJavaScriptFile(const QString filename) {
|
||||
return filename.contains(".js", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool isEntityFile(const QString filename) {
|
||||
bool static isEntityFile(const QString filename) {
|
||||
return filename.contains(".svo.json", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ class RequestFilters : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info);
|
||||
void interceptFileType(QWebEngineUrlRequestInfo& info);
|
||||
static void interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info);
|
||||
static void interceptFileType(QWebEngineUrlRequestInfo& info);
|
||||
};
|
||||
|
||||
#endif // hifi_RequestFilters_h
|
||||
|
|
Loading…
Reference in a new issue