From 066a5181421b1c91d8211b6210f99eaf337ae0ec Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 21 Nov 2016 13:07:38 -0800 Subject: [PATCH] expose metaverse url to javascript and use it rather than hardcoding --- libraries/networking/src/AddressManager.cpp | 5 +++++ libraries/networking/src/AddressManager.h | 2 ++ scripts/system/snapshot.js | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 05210012ba..240c722872 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -24,6 +24,7 @@ #include "AddressManager.h" #include "NodeList.h" +#include "NetworkingConstants.h" #include "NetworkLogging.h" #include "UserActivityLogger.h" #include "udt/PacketHeaders.h" @@ -754,6 +755,10 @@ QString AddressManager::getDomainId() const { return DependencyManager::get()->getDomainHandler().getUUID().toString(); } +const QUrl AddressManager::getMetaverseServerUrl() const { + return NetworkingConstants::METAVERSE_SERVER_URL; +} + void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) { // make sure that this response is for the domain we're currently connected to auto domainID = DependencyManager::get()->getDomainHandler().getUUID(); diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 366fc5dfab..c7d283ad02 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -41,6 +41,7 @@ class AddressManager : public QObject, public Dependency { Q_PROPERTY(QString pathname READ currentPath) Q_PROPERTY(QString placename READ getPlaceName) Q_PROPERTY(QString domainId READ getDomainId) + Q_PROPERTY(QUrl metaverseServerUrl READ getMetaverseServerUrl) public: Q_INVOKABLE QString protocolVersion(); using PositionGetter = std::function; @@ -70,6 +71,7 @@ public: const QUuid& getRootPlaceID() const { return _rootPlaceID; } const QString& getPlaceName() const { return _shareablePlaceName.isEmpty() ? _placeName : _shareablePlaceName; } QString getDomainId() const; + const QUrl getMetaverseServerUrl() const; const QString& getHost() const { return _host; } diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 6b8e2b32aa..f6ae6d153d 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -133,7 +133,7 @@ function isDomainOpen(id) { 'restriction=open,hifi' // If we're sharing, we're logged in // If we're here, protocol matches, and it is online ]; - var url = "https://metaverse.highfidelity.com/api/v1/user_stories?" + options.join('&'); + var url = location.metaverseServerUrl + "/api/v1/user_stories?" + options.join('&'); request.open("GET", url, false); request.send(); if (request.status != 200) {