diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4deea9ca0c..d4b88e8265 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4004,7 +4004,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { parser.parse(arguments()); if (parser.isSet(urlOption)) { QUrl url = QUrl(parser.value(urlOption)); - if (url.scheme() == URL_SCHEME_HIFIAPP) { + if (url.scheme() == URL_SCHEME_VIRCADIAAPP) { Setting::Handle<QVariant>("startUpApp").set(url.path()); } else { addressLookupString = url.toString(); @@ -7285,7 +7285,7 @@ void Application::clearDomainOctreeDetails(bool clearAll) { void Application::domainURLChanged(QUrl domainURL) { // disable physics until we have enough information about our new location to not cause craziness. - setIsServerlessMode(domainURL.scheme() != URL_SCHEME_HIFI); + setIsServerlessMode(domainURL.scheme() != URL_SCHEME_VIRCADIA); if (isServerlessMode()) { loadServerlessDomain(domainURL); } @@ -7294,7 +7294,7 @@ void Application::domainURLChanged(QUrl domainURL) { void Application::goToErrorDomainURL(QUrl errorDomainURL) { // disable physics until we have enough information about our new location to not cause craziness. - setIsServerlessMode(errorDomainURL.scheme() != URL_SCHEME_HIFI); + setIsServerlessMode(errorDomainURL.scheme() != URL_SCHEME_VIRCADIA); if (isServerlessMode()) { loadErrorDomain(errorDomainURL); } @@ -7658,7 +7658,7 @@ bool Application::canAcceptURL(const QString& urlString) const { QUrl url(urlString); if (url.query().contains(WEB_VIEW_TAG)) { return false; - } else if (urlString.startsWith(URL_SCHEME_HIFI)) { + } else if (urlString.startsWith(URL_SCHEME_VIRCADIA)) { return true; } QString lowerPath = url.path().toLower(); @@ -7673,7 +7673,7 @@ bool Application::canAcceptURL(const QString& urlString) const { bool Application::acceptURL(const QString& urlString, bool defaultUpload) { QUrl url(urlString); - if (url.scheme() == URL_SCHEME_HIFI) { + if (url.scheme() == URL_SCHEME_VIRCADIA) { // this is a hifi URL - have the AddressManager handle it QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString", Qt::AutoConnection, Q_ARG(const QString&, urlString)); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index d190e3f3da..4e338a629b 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -265,7 +265,7 @@ int main(int argc, const char* argv[]) { if (socket.waitForConnected(LOCAL_SERVER_TIMEOUT_MS)) { if (parser.isSet(urlOption)) { QUrl url = QUrl(parser.value(urlOption)); - if (url.isValid() && (url.scheme() == URL_SCHEME_HIFI || url.scheme() == URL_SCHEME_HIFIAPP + if (url.isValid() && (url.scheme() == URL_SCHEME_VIRCADIA || url.scheme() == URL_SCHEME_VIRCADIAAPP || url.scheme() == HIFI_URL_SCHEME_HTTP || url.scheme() == HIFI_URL_SCHEME_HTTPS || url.scheme() == HIFI_URL_SCHEME_FILE)) { qDebug() << "Writing URL to local socket"; diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index c8714e2a8f..e594ecd536 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -139,9 +139,9 @@ void WindowScriptingInterface::disconnectedFromDomain() { void WindowScriptingInterface::openUrl(const QUrl& url) { if (!url.isEmpty()) { auto scheme = url.scheme(); - if (scheme == URL_SCHEME_HIFI) { + if (scheme == URL_SCHEME_VIRCADIA) { DependencyManager::get<AddressManager>()->handleLookupString(url.toString()); - } else if (scheme == URL_SCHEME_HIFIAPP) { + } else if (scheme == URL_SCHEME_VIRCADIAAPP) { DependencyManager::get<QmlCommerce>()->openSystemApp(url.path()); } else { #if defined(Q_OS_ANDROID) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index f0fa1365c4..96d72cabaf 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -39,7 +39,7 @@ const QString SETTINGS_CURRENT_ADDRESS_KEY = "address"; const QString DEFAULT_VIRCADIA_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty()) ? BuildInfo::PRELOADED_STARTUP_LOCATION : NetworkingConstants::DEFAULT_VIRCADIA_ADDRESS; -const QString DEFAULT_HOME_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty()) +const QString DEFAULT_HOME_ADDRESS = (!BuildInfo::PRELOADED_STARTUP_LOCATION.isEmpty()) ? BuildInfo::PRELOADED_STARTUP_LOCATION : NetworkingConstants::DEFAULT_VIRCADIA_ADDRESS; @@ -56,7 +56,7 @@ QString AddressManager::getProtocol() const { QUrl AddressManager::currentAddress(bool domainOnly) const { QUrl hifiURL = _domainURL; - if (!domainOnly && hifiURL.scheme() == URL_SCHEME_HIFI) { + if (!domainOnly && hifiURL.scheme() == URL_SCHEME_VIRCADIA) { hifiURL.setPath(currentPath()); } @@ -65,7 +65,7 @@ QUrl AddressManager::currentAddress(bool domainOnly) const { QUrl AddressManager::currentFacingAddress() const { auto hifiURL = currentAddress(); - if (hifiURL.scheme() == URL_SCHEME_HIFI) { + if (hifiURL.scheme() == URL_SCHEME_VIRCADIA) { hifiURL.setPath(currentFacingPath()); } @@ -77,7 +77,7 @@ QUrl AddressManager::currentShareableAddress(bool domainOnly) const { // if we have a shareable place name use that instead of whatever the current host is QUrl hifiURL; - hifiURL.setScheme(URL_SCHEME_HIFI); + hifiURL.setScheme(URL_SCHEME_VIRCADIA); hifiURL.setHost(_shareablePlaceName); if (!domainOnly) { @@ -94,7 +94,7 @@ QUrl AddressManager::currentPublicAddress(bool domainOnly) const { // return an address that can be used by others to visit this client's current location. If // in a serverless domain (which can't be visited) return an empty URL. QUrl shareableAddress = currentShareableAddress(domainOnly); - if (shareableAddress.scheme() != URL_SCHEME_HIFI) { + if (shareableAddress.scheme() != URL_SCHEME_VIRCADIA) { return QUrl(); // file: urls aren't public } return shareableAddress; @@ -103,7 +103,7 @@ QUrl AddressManager::currentPublicAddress(bool domainOnly) const { QUrl AddressManager::currentFacingShareableAddress() const { auto hifiURL = currentShareableAddress(); - if (hifiURL.scheme() == URL_SCHEME_HIFI) { + if (hifiURL.scheme() == URL_SCHEME_VIRCADIA) { hifiURL.setPath(currentFacingPath()); } @@ -114,7 +114,7 @@ QUrl AddressManager::currentFacingPublicAddress() const { // return an address that can be used by others to visit this client's current location. If // in a serverless domain (which can't be visited) return an empty URL. QUrl shareableAddress = currentFacingShareableAddress(); - if (shareableAddress.scheme() != URL_SCHEME_HIFI) { + if (shareableAddress.scheme() != URL_SCHEME_VIRCADIA) { return QUrl(); // file: urls aren't public } return shareableAddress; @@ -165,7 +165,7 @@ void AddressManager::storeCurrentAddress() { if (url.scheme() == HIFI_URL_SCHEME_FILE || url.scheme() == HIFI_URL_SCHEME_HTTP || url.scheme() == HIFI_URL_SCHEME_HTTPS || - (url.scheme() == URL_SCHEME_HIFI && !url.host().isEmpty())) { + (url.scheme() == URL_SCHEME_VIRCADIA && !url.host().isEmpty())) { // TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can // be loaded over http(s) // url.scheme() == HIFI_URL_SCHEME_HTTP || @@ -242,7 +242,7 @@ const JSONCallbackParameters& AddressManager::apiCallbackParameters() { return callbackParams; } -bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { +bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger, const QString& lookupUrlInString) { static QString URL_TYPE_USER = "user"; static QString URL_TYPE_DOMAIN_ID = "domain_id"; static QString URL_TYPE_PLACE = "place"; @@ -258,24 +258,32 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { if (lookupUrl.scheme().isEmpty() && !lookupUrl.path().startsWith("/")) { // 'urls' without schemes are taken as domain names, as opposed to // simply a path portion of a url, so we need to set the scheme - lookupUrl.setScheme(URL_SCHEME_HIFI); + lookupUrl.setScheme(URL_SCHEME_VIRCADIA); } static const QRegExp PORT_REGEX = QRegExp("\\d{1,5}(\\/.*)?"); if(!lookupUrl.scheme().isEmpty() && lookupUrl.host().isEmpty() && PORT_REGEX.exactMatch(lookupUrl.path())) { // this is in the form somewhere:<port>, convert it to hifi://somewhere:<port> - lookupUrl = QUrl(URL_SCHEME_HIFI + "://" + lookupUrl.toString()); + lookupUrl = QUrl(URL_SCHEME_VIRCADIA + "://" + lookupUrl.toString()); } // it should be noted that url's in the form // somewhere:<port> are not valid, as that // would indicate that the scheme is 'somewhere' // use hifi://somewhere:<port> instead - if (lookupUrl.scheme() == URL_SCHEME_HIFI) { + if (lookupUrl.scheme() == URL_SCHEME_VIRCADIA || lookupUrlInString.startsWith(URL_SCHEME_VIRCADIA + "://")) { + QString lookupUrlString; + + if (lookupUrlInString.startsWith(URL_SCHEME_VIRCADIA + "://")) { + lookupUrlString = lookupUrlInString; + } else { + lookupUrlString = lookupUrl.toString(QUrl::FullyEncoded); + } + if (lookupUrl.host().isEmpty()) { // this was in the form hifi:/somewhere or hifi:somewhere. Fix it by making it hifi://somewhere - static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_HIFI + ":\\/{0,2}", Qt::CaseInsensitive); - lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_HIFI + "://")); + static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_VIRCADIA + ":\\/{0,2}", Qt::CaseInsensitive); + lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_VIRCADIA + "://")); } DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::LookupAddress); @@ -340,6 +348,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { // try to look up the domain ID on the metaverse API attemptDomainIDLookup(lookupUrl.host(), lookupUrl.path(), trigger); } else { + // wasn't an address - lookup the place name + // we may have a path that defines a relative viewpoint - pass that through the lookup so we can go to it after UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_PLACE, lookupUrl.toString()); // save the last visited domain URL. @@ -348,10 +358,26 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { // store this place name as the previous lookup in case we fail to connect and want to refresh API info _previousAPILookup = lookupUrl; - // wasn't an address - lookup the place name - // we may have a path that defines a relative viewpoint - pass that through the lookup so we can go to it after - if (!lookupUrl.host().isNull() && !lookupUrl.host().isEmpty()) { - attemptPlaceNameLookup(lookupUrl.host(), lookupUrl.path(), trigger); + // Let's convert this to a QString for processing in case there are spaces in it. + if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + "://", Qt::CaseInsensitive)) { + lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + "://"), ""); + } else if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + ":/", Qt::CaseInsensitive)) { + lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + ":/"), ""); + } else if (lookupUrlString.contains(URL_SCHEME_VIRCADIA + ":", Qt::CaseInsensitive)) { + lookupUrlString = lookupUrlString.replace((URL_SCHEME_VIRCADIA + ":"), ""); + } + + // Get the path and then strip it out. + QString lookupUrlStringPath; + + int index = lookupUrlString.indexOf('/'); + if (index != -1) { + lookupUrlStringPath = lookupUrlString.mid(index); + lookupUrlString.replace(lookupUrlStringPath, ""); + } + + if (!lookupUrlString.isEmpty()) { + attemptPlaceNameLookup(lookupUrlString, lookupUrlStringPath, trigger); } } } @@ -371,7 +397,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { return true; } else if (lookupUrl.scheme() == HIFI_URL_SCHEME_FILE || lookupUrl.scheme() == HIFI_URL_SCHEME_HTTPS || lookupUrl.scheme() == HIFI_URL_SCHEME_HTTP) { - + // Save the last visited domain URL. _lastVisitedURL = lookupUrl; @@ -412,13 +438,13 @@ bool isPossiblePlaceName(QString possiblePlaceName) { } void AddressManager::handleLookupString(const QString& lookupString, bool fromSuggestions) { + QString trimmedString = lookupString.trimmed(); - QString sanitizedString = lookupString.trimmed(); - if (!sanitizedString.isEmpty()) { + if (!trimmedString.isEmpty()) { resetConfirmConnectWithoutAvatarEntities(); // make this a valid hifi URL and handle it off to handleUrl - handleUrl(sanitizedString, fromSuggestions ? Suggestions : UserInput); + handleUrl(trimmedString, fromSuggestions ? Suggestions : UserInput, trimmedString); } } @@ -494,7 +520,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const qCDebug(networking) << "Possible domain change required to connect to" << domainHostname << "on" << domainPort; QUrl domainURL; - domainURL.setScheme(URL_SCHEME_HIFI); + domainURL.setScheme(URL_SCHEME_VIRCADIA); domainURL.setHost(domainHostname); if (domainPort > 0) { domainURL.setPort(domainPort); @@ -606,8 +632,6 @@ void AddressManager::handleAPIError(QNetworkReply* errorReply) { void AddressManager::attemptPlaceNameLookup(const QString& lookupString, const QString& overridePath, LookupTrigger trigger) { // assume this is a place name and see if we can get any info on it - QString placeName = QUrl::toPercentEncoding(lookupString); - QVariantMap requestParams; // if the user asked for a specific path with this lookup then keep it with the request so we can use it later @@ -618,7 +642,7 @@ void AddressManager::attemptPlaceNameLookup(const QString& lookupString, const Q // remember how this lookup was triggered for history storage handling later requestParams.insert(LOOKUP_TRIGGER_KEY, static_cast<int>(trigger)); - DependencyManager::get<AccountManager>()->sendRequest(GET_PLACE.arg(placeName), + DependencyManager::get<AccountManager>()->sendRequest(GET_PLACE.arg(lookupString), AccountManagerAuth::None, QNetworkAccessManager::GetOperation, apiCallbackParameters(), @@ -667,7 +691,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri emit lookupResultsFinished(); QUrl domainURL; - domainURL.setScheme(URL_SCHEME_HIFI); + domainURL.setScheme(URL_SCHEME_VIRCADIA); domainURL.setHost(domainIPString); if (domainPort > 0) { domainURL.setPort(domainPort); @@ -690,7 +714,7 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString, LookupTri emit lookupResultsFinished(); QUrl domainURL; - domainURL.setScheme(URL_SCHEME_HIFI); + domainURL.setScheme(URL_SCHEME_VIRCADIA); domainURL.setHost(domainHostname); if (domainPort > 0) { domainURL.setPort(domainPort); @@ -823,7 +847,7 @@ bool AddressManager::setHost(const QString& host, LookupTrigger trigger, quint16 addCurrentAddressToHistory(trigger); _domainURL = QUrl(); - _domainURL.setScheme(URL_SCHEME_HIFI); + _domainURL.setScheme(URL_SCHEME_VIRCADIA); _domainURL.setHost(host); if (port > 0) { _domainURL.setPort(port); @@ -860,7 +884,7 @@ bool AddressManager::setDomainInfo(const QUrl& domainURL, LookupTrigger trigger) // clear any current place information _rootPlaceID = QUuid(); - if (_domainURL.scheme() == URL_SCHEME_HIFI) { + if (_domainURL.scheme() == URL_SCHEME_VIRCADIA) { qCDebug(networking) << "Possible domain change required to connect to domain at" << hostname << "on" << port; } else { qCDebug(networking) << "Possible domain change required to serverless domain: " << domainURL.toString(); diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 31ef16a377..0a8f4591ad 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -4,6 +4,7 @@ // // Created by Stephen Birarda on 2014-09-10. // Copyright 2014 High Fidelity, Inc. +// Copyright 2021 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -35,7 +36,7 @@ const QString GET_PLACE = "/api/v1/places/%1"; * The <code>location</code> API provides facilities related to your current location in the metaverse. * * <h3>Getter/Setter</h3> - * <p>You can get and set your current metaverse address by directly reading a string value from and writing a string value to + * <p>You can get and set your current metaverse address by directly reading a string value from and writing a string value to * the <code>location</code> object. This is an alternative to using the <code>location.href</code> property or other object * functions.</p> * @@ -53,12 +54,12 @@ const QString GET_PLACE = "/api/v1/places/%1"; * <code>localhost</code>, or an IP address). Is blank if you're in a serverless domain. * <em>Read-only.</em> * @property {string} href - Your current metaverse address (e.g., <code>"hifi://domainname/15,-10,26/0,0,0,1"</code>) - * regardless of whether or not you're connected to the domain. Starts with <code>"file:///"</code> if you're in a + * regardless of whether or not you're connected to the domain. Starts with <code>"file:///"</code> if you're in a * serverless domain. * <em>Read-only.</em> * @property {boolean} isConnected - <code>true</code> if you're connected to the domain in your current <code>href</code> * metaverse address, otherwise <code>false</code>. - * @property {string} pathname - The location and orientation in your current <code>href</code> metaverse address + * @property {string} pathname - The location and orientation in your current <code>href</code> metaverse address * (e.g., <code>"/15,-10,26/0,0,0,1"</code>). * <em>Read-only.</em> * @property {string} placename - The place name in your current <code>href</code> metaverse address @@ -77,7 +78,7 @@ const QString GET_PLACE = "/api/v1/places/%1"; * @hifi-client-entity * @hifi-avatar * - * @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs + * @deprecated This API is deprecated and will be removed. Use the {@link location} or {@link Window|Window.location} APIs * instead. * * @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NULL} if you're not @@ -248,9 +249,9 @@ public slots: /*@jsdoc * Takes you to a specified metaverse address. * @function location.handleLookupString - * @param {string} address - The address to go to: a <code>"hifi://"</code> address, an IP address (e.g., - * <code>"127.0.0.1"</code> or <code>"localhost"</code>), a <code>file:///</code> address, a domain name, a named path - * on a domain (starts with <code>"/"</code>), a position or position and orientation, or a user (starts with + * @param {string} address - The address to go to: a <code>"hifi://"</code> address, an IP address (e.g., + * <code>"127.0.0.1"</code> or <code>"localhost"</code>), a <code>file:///</code> address, a domain name, a named path + * on a domain (starts with <code>"/"</code>), a position or position and orientation, or a user (starts with * <code>"@"</code>). * @param {boolean} [fromSuggestions=false] - Set to <code>true</code> if the address is obtained from the "Explore" app. * Helps ensure that the user's location history is correctly maintained. @@ -258,7 +259,7 @@ public slots: void handleLookupString(const QString& lookupString, bool fromSuggestions = false); /*@jsdoc - * Takes you to a position and orientation resulting from a lookup for a named path in the domain (set in the domain + * Takes you to a position and orientation resulting from a lookup for a named path in the domain (set in the domain * server's settings). * @function location.goToViewpointForPath * @param {string} path - The position and orientation corresponding to the named path. @@ -292,7 +293,7 @@ public slots: * location history is correctly maintained. */ void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) { - handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); + handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); } /*@jsdoc @@ -307,7 +308,7 @@ public slots: * Takes you to the specified user's location. * @function location.goToUser * @param {string} username - The user's username. - * @param {boolean} [matchOrientation=true] - If <code>true</code> then go to a location just in front of the user and turn + * @param {boolean} [matchOrientation=true] - If <code>true</code> then go to a location just in front of the user and turn * to face them, otherwise go to the user's exact location and orientation. */ void goToUser(const QString& username, bool shouldMatchOrientation = true); @@ -348,7 +349,7 @@ public slots: void copyAddress(); /*@jsdoc - * Copies your current metaverse location and orientation (i.e., <code>location.pathname</code> property value) to the OS + * Copies your current metaverse location and orientation (i.e., <code>location.pathname</code> property value) to the OS * clipboard. * @function location.copyPath */ @@ -374,7 +375,7 @@ signals: void lookupResultsFinished(); /*@jsdoc - * Triggered when looking up the details of a metaverse user or location to go to has completed and the domain or user is + * Triggered when looking up the details of a metaverse user or location to go to has completed and the domain or user is * offline. * @function location.lookupResultIsOffline * @returns {Signal} @@ -415,9 +416,9 @@ signals: * @function location.locationChangeRequired * @param {Vec3} position - The position to go to. * @param {boolean} hasOrientationChange - If <code>true</code> then a new <code>orientation</code> has been requested. - * @param {Quat} orientation - The orientation to change to. Is {@link Quat(0)|Quat.IDENTITY} if + * @param {Quat} orientation - The orientation to change to. Is {@link Quat(0)|Quat.IDENTITY} if * <code>hasOrientationChange</code> is <code>false</code>. - * @param {boolean} shouldFaceLocation - If <code>true</code> then the request is to go to a position near that specified + * @param {boolean} shouldFaceLocation - If <code>true</code> then the request is to go to a position near that specified * and orient your avatar to face it. For example when you visit someone from the "People" dialog. * @returns {Signal} * @example <caption>Report location change requests.</caption> @@ -468,7 +469,7 @@ signals: * Triggered when there's a change in whether or not there's a previous location that can be navigated to using * {@link location.goBack|goBack}. (Reflects changes in the state of the "Goto" dialog's back arrow.) * @function location.goBackPossible - * @param {boolean} isPossible - <code>true</code> if there's a previous location to navigate to, otherwise + * @param {boolean} isPossible - <code>true</code> if there's a previous location to navigate to, otherwise * <code>false</code>. * @returns {Signal} * @example <caption>Report when ability to navigate back changes.</caption> @@ -511,7 +512,7 @@ private: const JSONCallbackParameters& apiCallbackParameters(); - bool handleUrl(const QUrl& lookupUrl, LookupTrigger trigger = UserInput); + bool handleUrl(const QUrl& lookupUrl, LookupTrigger trigger = UserInput, const QString& lookupUrlInString = ""); bool handleNetworkAddress(const QString& lookupString, LookupTrigger trigger, bool& hostChanged); void handlePath(const QString& path, LookupTrigger trigger, bool wasPathOnly = false); diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 4291c1eda7..4ba5565a74 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -184,7 +184,7 @@ void DomainHandler::setSockAddr(const SockAddr& sockAddr, const QString& hostnam // some callers may pass a hostname, this is not to be used for lookup but for DTLS certificate verification _domainURL = QUrl(); - _domainURL.setScheme(URL_SCHEME_HIFI); + _domainURL.setScheme(URL_SCHEME_VIRCADIA); _domainURL.setHost(hostname); _domainURL.setPort(_sockAddr.getPort()); } @@ -199,7 +199,7 @@ void DomainHandler::setUUID(const QUuid& uuid) { void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) { _pendingDomainID = domainID; - if (domainURL.scheme() != URL_SCHEME_HIFI) { + if (domainURL.scheme() != URL_SCHEME_VIRCADIA) { _sockAddr.clear(); // if this is a file URL we need to see if it has a ~ for us to expand @@ -215,7 +215,7 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) { // if it's in the error state, reset and try again. if (_domainURL != domainURL - || (_sockAddr.getPort() != domainPort && domainURL.scheme() == URL_SCHEME_HIFI) + || (_sockAddr.getPort() != domainPort && domainURL.scheme() == URL_SCHEME_VIRCADIA) || isServerless() // For reloading content in serverless domain. || _isInErrorState) { // re-set the domain info so that auth information is reloaded @@ -230,7 +230,7 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) { qCDebug(networking) << "Updated domain hostname to" << domainURL.host(); if (!domainURL.host().isEmpty()) { - if (domainURL.scheme() == URL_SCHEME_HIFI) { + if (domainURL.scheme() == URL_SCHEME_VIRCADIA) { // re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname qCDebug(networking, "Looking up DS hostname %s.", domainURL.host().toLocal8Bit().constData()); QHostInfo::lookupHost(domainURL.host(), this, SLOT(completedHostnameLookup(const QHostInfo&))); @@ -303,7 +303,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname, void DomainHandler::activateICELocalSocket() { DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SetDomainSocket); _sockAddr = _icePeer.getLocalSocket(); - _domainURL.setScheme(URL_SCHEME_HIFI); + _domainURL.setScheme(URL_SCHEME_VIRCADIA); _domainURL.setHost(_sockAddr.getAddress().toString()); emit domainURLChanged(_domainURL); emit completedSocketDiscovery(); @@ -312,7 +312,7 @@ void DomainHandler::activateICELocalSocket() { void DomainHandler::activateICEPublicSocket() { DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SetDomainSocket); _sockAddr = _icePeer.getPublicSocket(); - _domainURL.setScheme(URL_SCHEME_HIFI); + _domainURL.setScheme(URL_SCHEME_VIRCADIA); _domainURL.setHost(_sockAddr.getAddress().toString()); emit domainURLChanged(_domainURL); emit completedSocketDiscovery(); @@ -369,7 +369,7 @@ void DomainHandler::setIsConnected(bool isConnected) { // FIXME: Reinstate the requestDomainSettings() call here in version 2021.2.0 instead of having it in // NodeList::processDomainServerList(). /* - if (_domainURL.scheme() == URL_SCHEME_HIFI && !_domainURL.host().isEmpty()) { + if (_domainURL.scheme() == URL_SCHEME_VIRCADIA && !_domainURL.host().isEmpty()) { // we've connected to new domain - time to ask it for global settings requestDomainSettings(); } diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 95bfb55894..7553168b09 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -137,7 +137,7 @@ public: void setCanConnectWithoutAvatarEntities(bool canConnect); bool canConnectWithoutAvatarEntities(); - bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_HIFI; } + bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_VIRCADIA; } bool getInterstitialModeEnabled() const; void setInterstitialModeEnabled(bool enableInterstitialMode); diff --git a/libraries/networking/src/NetworkingConstants.h b/libraries/networking/src/NetworkingConstants.h index d5ad90a6f4..ae3607eed9 100644 --- a/libraries/networking/src/NetworkingConstants.h +++ b/libraries/networking/src/NetworkingConstants.h @@ -25,7 +25,7 @@ namespace NetworkingConstants { // You can avoid changing that and still effectively use a connected domain on staging // if you manually generate a personal access token for the domains scope // at https://staging.highfidelity.com/user/tokens/new?for_domain_server=true - + const QString WEB_ENGINE_VERSION = "Chrome/83.0.4103.122"; // For now we only have one Metaverse server. @@ -35,21 +35,21 @@ namespace NetworkingConstants { // Web Engine requests to this parent domain have an account authorization header added const QString AUTH_HOSTNAME_BASE = "vircadia.com"; const QStringList IS_AUTHABLE_HOSTNAME = { "vircadia.com", "vircadia.io" }; - + // Use a custom User-Agent to avoid ModSecurity filtering, e.g. by hosting providers. const QByteArray VIRCADIA_USER_AGENT = "Mozilla/5.0 (VircadiaInterface)"; - + const QString WEB_ENGINE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " + WEB_ENGINE_VERSION + " Mobile Safari/537.36"; const QString MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " + WEB_ENGINE_VERSION + " Mobile Safari/537.36"; - + // WebEntity Defaults const QString WEB_ENTITY_DEFAULT_SOURCE_URL = "https://vircadia.com/"; const QString WEB_ENTITY_DEFAULT_USER_AGENT = WEB_ENGINE_USER_AGENT; - + // Builds URLs const QUrl BUILDS_XML_URL("https://highfidelity.com/builds.xml"); const QUrl MASTER_BUILDS_XML_URL("https://highfidelity.com/dev-builds.xml"); - + const QString DEFAULT_AVATAR_COLLISION_SOUND_URL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/Body_Hits_Impact.wav"; // CDN URLs @@ -71,20 +71,20 @@ namespace NetworkingConstants { const unsigned short STUN_SERVER_DEFAULT_PORT = 19302; #endif - const QUrl HELP_DOCS_URL { "https://docs.vircadia.dev" }; - const QUrl HELP_FORUM_URL { "https://forums.vircadia.dev" }; + const QUrl HELP_DOCS_URL { "https://docs.vircadia.com" }; + const QUrl HELP_FORUM_URL { "https://forum.vircadia.com" }; const QUrl HELP_SCRIPTING_REFERENCE_URL{ "https://apidocs.vircadia.dev/" }; - const QUrl HELP_RELEASE_NOTES_URL{ "https://docs.vircadia.dev/release-notes.html" }; + const QUrl HELP_RELEASE_NOTES_URL{ "https://docs.vircadia.com/release-notes.html" }; const QUrl HELP_BUG_REPORT_URL{ "https://github.com/vircadia/vircadia/issues" }; - + const QString DEFAULT_VIRCADIA_ADDRESS = "file:///~/serverless/tutorial.json"; const QString DEFAULT_HOME_ADDRESS = "file:///~/serverless/tutorial.json"; const QString REDIRECT_HIFI_ADDRESS = "file:///~/serverless/redirect.json"; } const QString HIFI_URL_SCHEME_ABOUT = "about"; -const QString URL_SCHEME_HIFI = "hifi"; -const QString URL_SCHEME_HIFIAPP = "hifiapp"; +const QString URL_SCHEME_VIRCADIA = "hifi"; +const QString URL_SCHEME_VIRCADIAAPP = "hifiapp"; const QString URL_SCHEME_DATA = "data"; const QString URL_SCHEME_QRC = "qrc"; const QString HIFI_URL_SCHEME_FILE = "file"; diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index ccbac287fa..e3a5452120 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -824,7 +824,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) // FIXME: Remove this call to requestDomainSettings() and reinstate the one in DomainHandler::setIsConnected(), in version // 2021.2.0. (New protocol version implies a domain server upgrade.) if (!_domainHandler.isConnected() - && _domainHandler.getScheme() == URL_SCHEME_HIFI && !_domainHandler.getHostname().isEmpty()) { + && _domainHandler.getScheme() == URL_SCHEME_VIRCADIA && !_domainHandler.getHostname().isEmpty()) { // We're about to connect but we need the domain settings (in particular, the node permissions) in order to adjust the // canRezAvatarEntities permission above before using the permissions in determining whether or not to connect without // avatar entities rezzing below. diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 417e6d94e5..6627f75ae6 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -2405,7 +2405,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co QString currentDomain = DependencyManager::get<AddressManager>()->getDomainURL().host(); QString domainSafeIP = nodeList->getDomainHandler().getHostname(); - QString domainSafeURL = URL_SCHEME_HIFI + "://" + currentDomain; + QString domainSafeURL = URL_SCHEME_VIRCADIA + "://" + currentDomain; for (const auto& str : safeURLPrefixes) { if (domainSafeURL.startsWith(str) || domainSafeIP.startsWith(str)) { qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: "