mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-22 21:29:12 +02:00
Add support for metaverse API's with paths.
This commit is contained in:
parent
d5f5c76878
commit
e3a6dc18af
10 changed files with 68 additions and 53 deletions
|
@ -8,20 +8,20 @@
|
||||||
{
|
{
|
||||||
"name": "access_token",
|
"name": "access_token",
|
||||||
"label": "Access Token",
|
"label": "Access Token",
|
||||||
"help": "This is your OAuth access token to connect this domain-server with your High Fidelity account. <br/>It can be generated by clicking the 'Connect Account' button above.<br/>You can also go to the <a href='https://metaverse.highfidelity.com/user/security' target='_blank'>My Security</a> page of your account and generate a token with the 'domains' scope and paste it here.",
|
"help": "This is your OAuth access token to connect this domain-server with your Metaverse account. <br/>It can be generated by clicking the 'Connect Account' button above.<br/>You can also go to the Security page of your account on your Metaverse Server and generate a token with the 'domains' scope and paste it here.",
|
||||||
"advanced": true,
|
"advanced": true,
|
||||||
"backup": false
|
"backup": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"label": "Domain ID",
|
"label": "Domain ID",
|
||||||
"help": "This is your High Fidelity domain ID. If you do not want your domain to be registered in the High Fidelity metaverse you can leave this blank.",
|
"help": "This is your Metaverse domain ID. If you do not want your domain to be registered in the Metaverse you can leave this blank.",
|
||||||
"advanced": true
|
"advanced": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "automatic_networking",
|
"name": "automatic_networking",
|
||||||
"label": "Automatic Networking",
|
"label": "Automatic Networking",
|
||||||
"help": "This defines how other nodes in the High Fidelity metaverse will be able to reach your domain-server.<br/>If you don't want to deal with any network settings, use full automatic networking.",
|
"help": "This defines how other nodes in the Metaverse will be able to reach your domain-server.<br/>If you don't want to deal with any network settings, use full automatic networking.",
|
||||||
"default": "disabled",
|
"default": "disabled",
|
||||||
"type": "select",
|
"type": "select",
|
||||||
"options": [
|
"options": [
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value": "disabled",
|
"value": "disabled",
|
||||||
"label": "None: use the network information I have entered for this domain at metaverse.highfidelity.com"
|
"label": "None: use the network information I have entered for this domain at in the Metaverse Server."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
{
|
{
|
||||||
"name": "enable_packet_verification",
|
"name": "enable_packet_verification",
|
||||||
"label": "Enable Packet Verification",
|
"label": "Enable Packet Verification",
|
||||||
"help": "Enable secure checksums on communication that uses the High Fidelity protocol. Increases security with possibly a small performance penalty.",
|
"help": "Enable secure checksums on communication that uses the Metaverse protocol. Increases security with possibly a small performance penalty.",
|
||||||
"default": true,
|
"default": true,
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"advanced": true
|
"advanced": true
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
"name": "descriptors",
|
"name": "descriptors",
|
||||||
"label": "Description",
|
"label": "Description",
|
||||||
"restart": false,
|
"restart": false,
|
||||||
"help": "This data will be queryable from your server. It may be collected by High Fidelity and used to share your domain with others.",
|
"help": "This data will be queryable from your server. It may be collected by the Metaverse and used to share your domain with others.",
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"name": "world_name",
|
"name": "world_name",
|
||||||
|
|
|
@ -52,7 +52,7 @@ var URLs = {
|
||||||
// STABLE METAVERSE_URL: https://metaverse.highfidelity.com
|
// STABLE METAVERSE_URL: https://metaverse.highfidelity.com
|
||||||
// STAGING METAVERSE_URL: https://staging.highfidelity.com
|
// STAGING METAVERSE_URL: https://staging.highfidelity.com
|
||||||
DEFAULT_METAVERSE_URL: "https://metaverse.vircadia.com/live",
|
DEFAULT_METAVERSE_URL: "https://metaverse.vircadia.com/live",
|
||||||
CDN_URL: 'https://cdn.highfidelity.com',
|
CDN_URL: 'https://content.vircadia.com/eu-c-1',
|
||||||
PLACE_URL: 'https://hifi.place',
|
PLACE_URL: 'https://hifi.place',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -501,9 +501,9 @@ function prepareAccessTokenPrompt(callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMetaverseUrl(callback) {
|
function getMetaverseUrl(callback) {
|
||||||
$.ajax('/domain/metaverse_info', {
|
$.ajax('/api/metaverse_info', {
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
callback(data.metaverse.metaverse_url);
|
callback(data.metaverse_url);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
callback(URLs.DEFAULT_METAVERSE_URL);
|
callback(URLs.DEFAULT_METAVERSE_URL);
|
||||||
|
|
|
@ -1156,7 +1156,7 @@ QUrl DomainServer::oauthAuthorizationURL(const QUuid& stateUUID) {
|
||||||
QUrl authorizationURL = _oauthProviderURL;
|
QUrl authorizationURL = _oauthProviderURL;
|
||||||
|
|
||||||
const QString OAUTH_AUTHORIZATION_PATH = "/oauth/authorize";
|
const QString OAUTH_AUTHORIZATION_PATH = "/oauth/authorize";
|
||||||
authorizationURL.setPath(OAUTH_AUTHORIZATION_PATH);
|
authorizationURL.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + OAUTH_AUTHORIZATION_PATH);
|
||||||
|
|
||||||
QUrlQuery authorizationQuery;
|
QUrlQuery authorizationQuery;
|
||||||
|
|
||||||
|
@ -1620,7 +1620,7 @@ void DomainServer::sendICEServerAddressToMetaverseAPI() {
|
||||||
callbackParameters.errorCallbackMethod = "handleFailedICEServerAddressUpdate";
|
callbackParameters.errorCallbackMethod = "handleFailedICEServerAddressUpdate";
|
||||||
callbackParameters.jsonCallbackMethod = "handleSuccessfulICEServerAddressUpdate";
|
callbackParameters.jsonCallbackMethod = "handleSuccessfulICEServerAddressUpdate";
|
||||||
|
|
||||||
qCDebug(domain_server_ice) << "Updating ice-server address in High Fidelity Metaverse API to"
|
qCDebug(domain_server_ice) << "Updating ice-server address in Metaverse API to"
|
||||||
<< (_iceServerSocket.isNull() ? "" : _iceServerSocket.getAddress().toString());
|
<< (_iceServerSocket.isNull() ? "" : _iceServerSocket.getAddress().toString());
|
||||||
|
|
||||||
static const QString DOMAIN_ICE_ADDRESS_UPDATE = "/api/v1/domains/%1/ice_server_address";
|
static const QString DOMAIN_ICE_ADDRESS_UPDATE = "/api/v1/domains/%1/ice_server_address";
|
||||||
|
@ -1979,7 +1979,6 @@ const QString URI_OAUTH = "/oauth";
|
||||||
bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool skipSubHandler) {
|
bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool skipSubHandler) {
|
||||||
const QString JSON_MIME_TYPE = "application/json";
|
const QString JSON_MIME_TYPE = "application/json";
|
||||||
|
|
||||||
const QString URI_DOMAIN_METAVERSE_INFO = "/domain/metaverse_info";
|
|
||||||
const QString URI_ID = "/id";
|
const QString URI_ID = "/id";
|
||||||
const QString URI_ASSIGNMENT = "/assignment";
|
const QString URI_ASSIGNMENT = "/assignment";
|
||||||
const QString URI_NODES = "/nodes";
|
const QString URI_NODES = "/nodes";
|
||||||
|
@ -2065,20 +2064,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if this is a request for our selected metaverse server info
|
|
||||||
if (connection->requestOperation() == QNetworkAccessManager::GetOperation
|
|
||||||
&& url.path() == URI_DOMAIN_METAVERSE_INFO) {
|
|
||||||
const QString MIME_TYPE = "application/json";
|
|
||||||
|
|
||||||
QString metaverseURL{ MetaverseAPI::getCurrentMetaverseServerURL().toString() };
|
|
||||||
QJsonObject jsonObject{ { "metaverse_url", metaverseURL } };
|
|
||||||
QString domainMetaverseInfoJSON =
|
|
||||||
QString("{\"metaverse\":%1}").arg(QString(QJsonDocument(jsonObject).toJson(QJsonDocument::Compact)));
|
|
||||||
|
|
||||||
connection->respond(HTTPConnection::StatusCode200, domainMetaverseInfoJSON.toUtf8(), qPrintable(MIME_TYPE));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// all requests below require a cookie to prove authentication so check that first
|
// all requests below require a cookie to prove authentication so check that first
|
||||||
bool isAuthenticated { false };
|
bool isAuthenticated { false };
|
||||||
std::tie(isAuthenticated, username) = isAuthenticatedRequest(connection);
|
std::tie(isAuthenticated, username) = isAuthenticatedRequest(connection);
|
||||||
|
@ -2577,7 +2562,7 @@ bool DomainServer::handleHTTPSRequest(HTTPSConnection* connection, const QUrl &u
|
||||||
|
|
||||||
const QString OAUTH_TOKEN_REQUEST_PATH = "/oauth/token";
|
const QString OAUTH_TOKEN_REQUEST_PATH = "/oauth/token";
|
||||||
QUrl tokenRequestUrl = _oauthProviderURL;
|
QUrl tokenRequestUrl = _oauthProviderURL;
|
||||||
tokenRequestUrl.setPath(OAUTH_TOKEN_REQUEST_PATH);
|
tokenRequestUrl.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + OAUTH_TOKEN_REQUEST_PATH);
|
||||||
|
|
||||||
const QString OAUTH_GRANT_TYPE_POST_STRING = "grant_type=authorization_code";
|
const QString OAUTH_GRANT_TYPE_POST_STRING = "grant_type=authorization_code";
|
||||||
QString tokenPostBody = OAUTH_GRANT_TYPE_POST_STRING;
|
QString tokenPostBody = OAUTH_GRANT_TYPE_POST_STRING;
|
||||||
|
@ -2891,7 +2876,7 @@ QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenR
|
||||||
|
|
||||||
// fire off a request to get this user's identity so we can see if we will let them in
|
// fire off a request to get this user's identity so we can see if we will let them in
|
||||||
QUrl profileURL = _oauthProviderURL;
|
QUrl profileURL = _oauthProviderURL;
|
||||||
profileURL.setPath("/api/v1/user/profile");
|
profileURL.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + "/api/v1/user/profile");
|
||||||
profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken));
|
profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken));
|
||||||
|
|
||||||
qDebug() << "Sending profile request to: " << profileURL;
|
qDebug() << "Sending profile request to: " << profileURL;
|
||||||
|
|
|
@ -211,8 +211,15 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) {
|
||||||
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QUrl publicKeyURL{ MetaverseAPI::getCurrentMetaverseServerURL() };
|
QUrl publicKeyURL{ MetaverseAPI::getCurrentMetaverseServerURL() };
|
||||||
|
// qDebug() << "publicKeyURL" << publicKeyURL;
|
||||||
|
// qDebug() << "MetaverseAPI::getCurrentMetaverseServerURLPath()" << MetaverseAPI::getCurrentMetaverseServerURLPath();
|
||||||
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("/" + MetaverseAPI::getCurrentMetaverseServerURLPath() + publicKeyPath);
|
||||||
|
// qDebug() << "publicKeyPath" << publicKeyPath;
|
||||||
|
// qDebug() << "publicKeyURL.setPath" << "/" + MetaverseAPI::getCurrentMetaverseServerURLPath() + publicKeyPath;
|
||||||
|
// qDebug() << "publicKeyURL" << publicKeyURL;
|
||||||
|
// qDebug() << "publicKeyURL.isValid()" << publicKeyURL.isValid();
|
||||||
|
// qDebug() << "publicKeyURL.errorString()" << publicKeyURL.errorString();
|
||||||
|
|
||||||
QNetworkRequest publicKeyRequest { publicKeyURL };
|
QNetworkRequest publicKeyRequest { publicKeyURL };
|
||||||
publicKeyRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
publicKeyRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
|
|
|
@ -30,7 +30,7 @@ QNetworkRequest createNetworkRequest() {
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
|
|
||||||
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
||||||
requestURL.setPath(USER_ACTIVITY_URL);
|
requestURL.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + USER_ACTIVITY_URL);
|
||||||
|
|
||||||
request.setUrl(requestURL);
|
request.setUrl(requestURL);
|
||||||
|
|
||||||
|
|
|
@ -1492,7 +1492,7 @@ void EntityTree::startDynamicDomainVerificationOnServer(float minimumAgeToRemove
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
||||||
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/location");
|
requestURL.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + "/api/v1/commerce/proof_of_purchase_status/location");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request["certificate_id"] = certificateID;
|
request["certificate_id"] = certificateID;
|
||||||
networkRequest.setUrl(requestURL);
|
networkRequest.setUrl(requestURL);
|
||||||
|
@ -1724,7 +1724,7 @@ void EntityTree::validatePop(const QString& certID, const EntityItemID& entityIt
|
||||||
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
|
||||||
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/transfer");
|
requestURL.setPath(MetaverseAPI::getCurrentMetaverseServerURLPath() + "/api/v1/commerce/proof_of_purchase_status/transfer");
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request["certificate_id"] = certID;
|
request["certificate_id"] = certID;
|
||||||
networkRequest.setUrl(requestURL);
|
networkRequest.setUrl(requestURL);
|
||||||
|
|
|
@ -221,18 +221,23 @@ QNetworkRequest AccountManager::createRequest(QString path, AccountManagerAuth::
|
||||||
uuidStringWithoutCurlyBraces(_sessionID).toLocal8Bit());
|
uuidStringWithoutCurlyBraces(_sessionID).toLocal8Bit());
|
||||||
|
|
||||||
QUrl requestURL = _authURL;
|
QUrl requestURL = _authURL;
|
||||||
|
|
||||||
if (requestURL.isEmpty()) { // Assignment client doesn't set _authURL.
|
if (requestURL.isEmpty()) { // Assignment client doesn't set _authURL.
|
||||||
requestURL = getMetaverseServerURL();
|
requestURL = getMetaverseServerURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// qCDebug(networking) << "Received path" << path;
|
||||||
|
// qCDebug(networking) << "path.left(path.indexOf(\" ? \"))" << path.left(path.indexOf("?"));
|
||||||
|
// qCDebug(networking) << "getMetaverseServerURLPath(true)" << getMetaverseServerURLPath(true);
|
||||||
|
|
||||||
int queryStringLocation = path.indexOf("?");
|
int queryStringLocation = path.indexOf("?");
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
requestURL.setPath(path.left(queryStringLocation));
|
requestURL.setPath(getMetaverseServerURLPath(false) + path.left(queryStringLocation));
|
||||||
} else {
|
} else {
|
||||||
requestURL.setPath("/" + path.left(queryStringLocation));
|
requestURL.setPath(getMetaverseServerURLPath(true) + path.left(queryStringLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// qCDebug(networking) << "Creating request path" << requestURL;
|
||||||
|
|
||||||
if (queryStringLocation >= 0) {
|
if (queryStringLocation >= 0) {
|
||||||
QUrlQuery query(path.mid(queryStringLocation+1));
|
QUrlQuery query(path.mid(queryStringLocation+1));
|
||||||
requestURL.setQuery(query);
|
requestURL.setQuery(query);
|
||||||
|
@ -556,7 +561,7 @@ void AccountManager::requestAccessToken(const QString& login, const QString& pas
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
grantURL.setPath("/oauth/token");
|
grantURL.setPath(getMetaverseServerURLPath() + "/oauth/token");
|
||||||
|
|
||||||
QByteArray postData;
|
QByteArray postData;
|
||||||
postData.append("grant_type=password&");
|
postData.append("grant_type=password&");
|
||||||
|
@ -579,7 +584,7 @@ void AccountManager::requestAccessTokenWithAuthCode(const QString& authCode, con
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
grantURL.setPath("/oauth/token");
|
grantURL.setPath(getMetaverseServerURLPath() + "/oauth/token");
|
||||||
|
|
||||||
QByteArray postData;
|
QByteArray postData;
|
||||||
postData.append("grant_type=authorization_code&");
|
postData.append("grant_type=authorization_code&");
|
||||||
|
@ -602,7 +607,7 @@ void AccountManager::requestAccessTokenWithSteam(QByteArray authSessionTicket) {
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
grantURL.setPath("/oauth/token");
|
grantURL.setPath(getMetaverseServerURLPath() + "/oauth/token");
|
||||||
|
|
||||||
QByteArray postData;
|
QByteArray postData;
|
||||||
postData.append("grant_type=password&");
|
postData.append("grant_type=password&");
|
||||||
|
@ -624,7 +629,7 @@ void AccountManager::requestAccessTokenWithOculus(const QString& nonce, const QS
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
grantURL.setPath("/oauth/token");
|
grantURL.setPath(getMetaverseServerURLPath() + "/oauth/token");
|
||||||
|
|
||||||
QByteArray postData;
|
QByteArray postData;
|
||||||
postData.append("grant_type=password&");
|
postData.append("grant_type=password&");
|
||||||
|
@ -655,7 +660,7 @@ void AccountManager::refreshAccessToken() {
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
grantURL.setPath("/oauth/token");
|
grantURL.setPath(getMetaverseServerURLPath() + "/oauth/token");
|
||||||
|
|
||||||
QByteArray postData;
|
QByteArray postData;
|
||||||
postData.append("grant_type=refresh_token&");
|
postData.append("grant_type=refresh_token&");
|
||||||
|
@ -688,7 +693,7 @@ void AccountManager::setAccessTokens(const QString& response) {
|
||||||
} else {
|
} else {
|
||||||
// clear the path from the response URL so we have the right root URL for this access token
|
// clear the path from the response URL so we have the right root URL for this access token
|
||||||
QUrl rootURL = rootObject.contains("url") ? rootObject["url"].toString() : _authURL;
|
QUrl rootURL = rootObject.contains("url") ? rootObject["url"].toString() : _authURL;
|
||||||
rootURL.setPath("");
|
rootURL.setPath(getMetaverseServerURLPath() + "");
|
||||||
|
|
||||||
qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
||||||
|
|
||||||
|
@ -723,7 +728,7 @@ void AccountManager::requestAccessTokenFinished() {
|
||||||
} else {
|
} else {
|
||||||
// clear the path from the response URL so we have the right root URL for this access token
|
// clear the path from the response URL so we have the right root URL for this access token
|
||||||
QUrl rootURL = requestReply->url();
|
QUrl rootURL = requestReply->url();
|
||||||
rootURL.setPath("");
|
rootURL.setPath(getMetaverseServerURLPath() + "");
|
||||||
|
|
||||||
qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString());
|
||||||
|
|
||||||
|
@ -759,7 +764,7 @@ void AccountManager::refreshAccessTokenFinished() {
|
||||||
} else {
|
} else {
|
||||||
// clear the path from the response URL so we have the right root URL for this access token
|
// clear the path from the response URL so we have the right root URL for this access token
|
||||||
QUrl rootURL = requestReply->url();
|
QUrl rootURL = requestReply->url();
|
||||||
rootURL.setPath("");
|
rootURL.setPath(getMetaverseServerURLPath() + "");
|
||||||
|
|
||||||
qCDebug(networking) << "Storing an account with a refreshed access-token for" << qPrintable(rootURL.toString());
|
qCDebug(networking) << "Storing an account with a refreshed access-token for" << qPrintable(rootURL.toString());
|
||||||
|
|
||||||
|
@ -784,7 +789,7 @@ void AccountManager::requestProfile() {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QUrl profileURL = _authURL;
|
QUrl profileURL = _authURL;
|
||||||
profileURL.setPath("/api/v1/user/profile");
|
profileURL.setPath(getMetaverseServerURLPath() + "/api/v1/user/profile");
|
||||||
|
|
||||||
QNetworkRequest profileRequest(profileURL);
|
QNetworkRequest profileRequest(profileURL);
|
||||||
profileRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
profileRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
|
@ -834,7 +839,7 @@ void AccountManager::requestAccountSettings() {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QUrl lockerURL = _authURL;
|
QUrl lockerURL = _authURL;
|
||||||
lockerURL.setPath("/api/v1/user/locker");
|
lockerURL.setPath(getMetaverseServerURLPath() + "/api/v1/user/locker");
|
||||||
|
|
||||||
QNetworkRequest lockerRequest(lockerURL);
|
QNetworkRequest lockerRequest(lockerURL);
|
||||||
lockerRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
lockerRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
|
@ -905,7 +910,7 @@ void AccountManager::postAccountSettings() {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QUrl lockerURL = _authURL;
|
QUrl lockerURL = _authURL;
|
||||||
lockerURL.setPath("/api/v1/user/locker");
|
lockerURL.setPath(getMetaverseServerURLPath() + "/api/v1/user/locker");
|
||||||
|
|
||||||
QNetworkRequest lockerRequest(lockerURL);
|
QNetworkRequest lockerRequest(lockerURL);
|
||||||
lockerRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
lockerRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
|
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
|
||||||
|
|
||||||
QUrl getMetaverseServerURL() { return MetaverseAPI::getCurrentMetaverseServerURL(); }
|
QUrl getMetaverseServerURL() { return MetaverseAPI::getCurrentMetaverseServerURL(); }
|
||||||
|
QString getMetaverseServerURLPath(bool appendForwardSlash = false) {
|
||||||
|
return MetaverseAPI::getCurrentMetaverseServerURLPath(appendForwardSlash);
|
||||||
|
}
|
||||||
|
|
||||||
void removeAccountFromFile();
|
void removeAccountFromFile();
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// MetaverseAPI.cpp
|
// MetaverseAPI.cpp
|
||||||
// libraries/networking/src
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Kalila (kasenvr) on 2019-12-16.
|
// Created by Kalila L. on 2019-12-16.
|
||||||
// Copyright 2019 Vircadia
|
// Copyright 2019 Vircadia contributors.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -35,4 +35,18 @@ namespace MetaverseAPI {
|
||||||
|
|
||||||
return selectedMetaverseURL;
|
return selectedMetaverseURL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QString getCurrentMetaverseServerURLPath(bool appendForwardSlash){
|
||||||
|
QString path = getCurrentMetaverseServerURL().path();
|
||||||
|
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (appendForwardSlash) {
|
||||||
|
path.append("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
} // namespace MetaverseAPI
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// MetaverseAPI.h
|
// MetaverseAPI.h
|
||||||
// libraries/networking/src
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Kalila (kasenvr) on 2019-12-16.
|
// Created by Kalila L. on 2019-12-16.
|
||||||
// Copyright 2019 Vircadia
|
// Copyright 2019 Vircadia contributors.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
namespace MetaverseAPI {
|
namespace MetaverseAPI {
|
||||||
QUrl getCurrentMetaverseServerURL();
|
QUrl getCurrentMetaverseServerURL();
|
||||||
|
QString getCurrentMetaverseServerURLPath(bool appendForwardSlash = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // athena_MetaverseAPI_h
|
#endif // athena_MetaverseAPI_h
|
||||||
|
|
Loading…
Reference in a new issue