mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
Merge pull request #11974 from birarda/feat/staging-env-or-cl
allow custom metaverse URL to be used with env var
This commit is contained in:
commit
ed5082e5d4
18 changed files with 37 additions and 22 deletions
|
@ -477,7 +477,7 @@ void EntityServer::startDynamicDomainVerification() {
|
||||||
QNetworkRequest networkRequest;
|
QNetworkRequest networkRequest;
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/location");
|
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/location");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request["certificate_id"] = i.key();
|
request["certificate_id"] = i.key();
|
||||||
|
|
|
@ -94,7 +94,7 @@ bool DomainServer::forwardMetaverseAPIRequest(HTTPConnection* connection,
|
||||||
root.insert(requestSubobjectKey, subobject);
|
root.insert(requestSubobjectKey, subobject);
|
||||||
QJsonDocument doc { root };
|
QJsonDocument doc { root };
|
||||||
|
|
||||||
QUrl url { NetworkingConstants::METAVERSE_SERVER_URL.toString() + metaversePath };
|
QUrl url { NetworkingConstants::METAVERSE_SERVER_URL().toString() + metaversePath };
|
||||||
|
|
||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
req.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
req.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
|
@ -420,7 +420,7 @@ bool DomainServer::optionallySetupOAuth() {
|
||||||
|
|
||||||
// if we don't have an oauth provider URL then we default to the default node auth url
|
// if we don't have an oauth provider URL then we default to the default node auth url
|
||||||
if (_oauthProviderURL.isEmpty()) {
|
if (_oauthProviderURL.isEmpty()) {
|
||||||
_oauthProviderURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
_oauthProviderURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
@ -2159,7 +2159,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
QJsonDocument doc(root);
|
QJsonDocument doc(root);
|
||||||
|
|
||||||
|
|
||||||
QUrl url { NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/api/v1/places/" + place_id };
|
QUrl url { NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/v1/places/" + place_id };
|
||||||
|
|
||||||
url.setQuery("access_token=" + accessTokenVariant->toString());
|
url.setQuery("access_token=" + accessTokenVariant->toString());
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) {
|
||||||
// send a request to the metaverse API for the public key for this domain
|
// send a request to the metaverse API for the public key for this domain
|
||||||
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL };
|
QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL() };
|
||||||
QString publicKeyPath = QString("/api/v1/domains/%1/public_key").arg(uuidStringWithoutCurlyBraces(domainID));
|
QString publicKeyPath = QString("/api/v1/domains/%1/public_key").arg(uuidStringWithoutCurlyBraces(domainID));
|
||||||
publicKeyURL.setPath(publicKeyPath);
|
publicKeyURL.setPath(publicKeyPath);
|
||||||
|
|
||||||
|
|
|
@ -971,7 +971,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
|
|
||||||
// set the account manager's root URL and trigger a login request if we don't have the access token
|
// set the account manager's root URL and trigger a login request if we don't have the access token
|
||||||
accountManager->setIsAgent(true);
|
accountManager->setIsAgent(true);
|
||||||
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
|
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
|
||||||
|
|
||||||
auto addressManager = DependencyManager::get<AddressManager>();
|
auto addressManager = DependencyManager::get<AddressManager>();
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ QString amountString(const QString& label, const QString&color, const QJsonValue
|
||||||
return result + QString("</font>");
|
return result + QString("</font>");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace/items/";
|
static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/";
|
||||||
void Ledger::historySuccess(QNetworkReply& reply) {
|
void Ledger::historySuccess(QNetworkReply& reply) {
|
||||||
// here we send a historyResult with some extra stuff in it
|
// here we send a historyResult with some extra stuff in it
|
||||||
// Namely, the styled text we'd like to show. The issue is the
|
// Namely, the styled text we'd like to show. The issue is the
|
||||||
|
|
|
@ -28,7 +28,7 @@ QNetworkRequest createNetworkRequest() {
|
||||||
|
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
|
|
||||||
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
requestURL.setPath(USER_ACTIVITY_URL);
|
requestURL.setPath(USER_ACTIVITY_URL);
|
||||||
|
|
||||||
request.setUrl(requestURL);
|
request.setUrl(requestURL);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
bool forwardEnabled() { return _forwardEnabled; }
|
bool forwardEnabled() { return _forwardEnabled; }
|
||||||
bool useFeed() { return _useFeed; }
|
bool useFeed() { return _useFeed; }
|
||||||
void setUseFeed(bool useFeed) { if (_useFeed != useFeed) { _useFeed = useFeed; emit useFeedChanged(); } }
|
void setUseFeed(bool useFeed) { if (_useFeed != useFeed) { _useFeed = useFeed; emit useFeedChanged(); } }
|
||||||
QString metaverseServerUrl() { return NetworkingConstants::METAVERSE_SERVER_URL.toString(); }
|
QString metaverseServerUrl() { return NetworkingConstants::METAVERSE_SERVER_URL().toString(); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void backEnabledChanged();
|
void backEnabledChanged();
|
||||||
|
|
|
@ -289,7 +289,7 @@ void ContextOverlayInterface::openInspectionCertificate() {
|
||||||
QNetworkRequest networkRequest;
|
QNetworkRequest networkRequest;
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/transfer");
|
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/transfer");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request["certificate_id"] = entityProperties.getCertificateID();
|
request["certificate_id"] = entityProperties.getCertificateID();
|
||||||
|
@ -359,7 +359,7 @@ void ContextOverlayInterface::openInspectionCertificate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QString MARKETPLACE_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace/items/";
|
static const QString MARKETPLACE_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/";
|
||||||
|
|
||||||
void ContextOverlayInterface::openMarketplace() {
|
void ContextOverlayInterface::openMarketplace() {
|
||||||
// lets open the tablet and go to the current item in
|
// lets open the tablet and go to the current item in
|
||||||
|
|
|
@ -2840,7 +2840,7 @@ void EntityItem::retrieveMarketplacePublicKey() {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest;
|
QNetworkRequest networkRequest;
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
requestURL.setPath("/api/v1/commerce/marketplace_key");
|
requestURL.setPath("/api/v1/commerce/marketplace_key");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
networkRequest.setUrl(requestURL);
|
networkRequest.setUrl(requestURL);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/ecdsa.h>
|
#include <openssl/ecdsa.h>
|
||||||
#include <NetworkingConstants.h>
|
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
#include <QtNetwork/QNetworkRequest>
|
#include <QtNetwork/QNetworkRequest>
|
||||||
|
|
|
@ -1308,7 +1308,7 @@ void EntityTree::validatePop(const QString& certID, const EntityItemID& entityIt
|
||||||
QNetworkRequest networkRequest;
|
QNetworkRequest networkRequest;
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/transfer");
|
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/transfer");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request["certificate_id"] = certID;
|
request["certificate_id"] = certID;
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
void setTemporaryDomain(const QUuid& domainID, const QString& key);
|
void setTemporaryDomain(const QUuid& domainID, const QString& key);
|
||||||
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
|
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
|
||||||
|
|
||||||
QUrl getMetaverseServerURL() { return NetworkingConstants::METAVERSE_SERVER_URL; }
|
QUrl getMetaverseServerURL() { return NetworkingConstants::METAVERSE_SERVER_URL(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestAccessToken(const QString& login, const QString& password);
|
void requestAccessToken(const QString& login, const QString& password);
|
||||||
|
|
|
@ -12,15 +12,31 @@
|
||||||
#ifndef hifi_NetworkingConstants_h
|
#ifndef hifi_NetworkingConstants_h
|
||||||
#define hifi_NetworkingConstants_h
|
#define hifi_NetworkingConstants_h
|
||||||
|
|
||||||
|
#include <QtCore/QProcessEnvironment>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
namespace NetworkingConstants {
|
namespace NetworkingConstants {
|
||||||
// If you want to use STAGING instead of STABLE,
|
// If you want to use STAGING instead of STABLE,
|
||||||
// don't forget to ALSO change the Domain Server Metaverse Server URL inside of:
|
// links from the Domain Server web interface (like the connect account token generation)
|
||||||
|
// will still point at stable unless you ALSO change the Domain Server Metaverse Server URL inside of:
|
||||||
// <hifi repo>\domain-server\resources\web\js\shared.js
|
// <hifi repo>\domain-server\resources\web\js\shared.js
|
||||||
|
|
||||||
|
// 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 QUrl METAVERSE_SERVER_URL_STABLE("https://metaverse.highfidelity.com");
|
const QUrl METAVERSE_SERVER_URL_STABLE("https://metaverse.highfidelity.com");
|
||||||
const QUrl METAVERSE_SERVER_URL_STAGING("https://staging.highfidelity.com");
|
const QUrl METAVERSE_SERVER_URL_STAGING("https://staging.highfidelity.com");
|
||||||
const QUrl METAVERSE_SERVER_URL = METAVERSE_SERVER_URL_STABLE;
|
|
||||||
|
// You can change the return of this function if you want to use a custom metaverse URL at compile time
|
||||||
|
// or you can pass a custom URL via the env variable
|
||||||
|
static const QUrl METAVERSE_SERVER_URL() {
|
||||||
|
static const QString HIFI_METAVERSE_URL_ENV = "HIFI_METAVERSE_URL";
|
||||||
|
static const QUrl serverURL = QProcessEnvironment::systemEnvironment().contains(HIFI_METAVERSE_URL_ENV)
|
||||||
|
? QUrl(QProcessEnvironment::systemEnvironment().value(HIFI_METAVERSE_URL_ENV))
|
||||||
|
: METAVERSE_SERVER_URL_STABLE;
|
||||||
|
return serverURL;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_NetworkingConstants_h
|
#endif // hifi_NetworkingConstants_h
|
||||||
|
|
|
@ -35,7 +35,7 @@ QNetworkReply* OAuthNetworkAccessManager::createRequest(QNetworkAccessManager::O
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
||||||
if (accountManager->hasValidAccessToken()
|
if (accountManager->hasValidAccessToken()
|
||||||
&& req.url().host() == NetworkingConstants::METAVERSE_SERVER_URL.host()) {
|
&& req.url().host() == NetworkingConstants::METAVERSE_SERVER_URL().host()) {
|
||||||
QNetworkRequest authenticatedRequest(req);
|
QNetworkRequest authenticatedRequest(req);
|
||||||
authenticatedRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
authenticatedRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ScriptEngine.h"
|
#include "ScriptEngine.h"
|
||||||
#include "XMLHttpRequestClass.h"
|
#include "XMLHttpRequestClass.h"
|
||||||
|
|
||||||
const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/api/";
|
const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/";
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QByteArray*)
|
Q_DECLARE_METATYPE(QByteArray*)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool isAuthableHighFidelityURL(const QUrl& url) {
|
bool isAuthableHighFidelityURL(const QUrl& url) {
|
||||||
auto metaverseServerURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
auto metaverseServerURL = NetworkingConstants::METAVERSE_SERVER_URL();
|
||||||
static const QStringList HF_HOSTS = {
|
static const QStringList HF_HOSTS = {
|
||||||
"highfidelity.com", "highfidelity.io",
|
"highfidelity.com", "highfidelity.io",
|
||||||
metaverseServerURL.toString(), "metaverse.highfidelity.io"
|
metaverseServerURL.toString(), "metaverse.highfidelity.io"
|
||||||
|
|
|
@ -106,7 +106,7 @@ ACClientApp::ACClientApp(int argc, char* argv[]) :
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
accountManager->setIsAgent(true);
|
accountManager->setIsAgent(true);
|
||||||
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
|
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ ATPClientApp::ATPClientApp(int argc, char* argv[]) :
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
accountManager->setIsAgent(true);
|
accountManager->setIsAgent(true);
|
||||||
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
|
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue