expose metaverse url to javascript and use it rather than hardcoding

This commit is contained in:
howard-stearns 2016-11-21 13:07:38 -08:00
parent 5b216578d7
commit 066a518142
3 changed files with 8 additions and 1 deletions

View file

@ -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<NodeList>()->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<NodeList>()->getDomainHandler().getUUID();

View file

@ -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<glm::vec3()>;
@ -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; }

View file

@ -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) {