add a networking constants class with metaverse URL

This commit is contained in:
Stephen Birarda 2015-03-31 16:40:21 -07:00
parent c336d235bf
commit 61806935bb
10 changed files with 38 additions and 14 deletions

View file

@ -20,6 +20,7 @@
#include <AccountManager.h> #include <AccountManager.h>
#include <HTTPConnection.h> #include <HTTPConnection.h>
#include <LogHandler.h> #include <LogHandler.h>
#include <NetworkingConstants.h>
#include <UUID.h> #include <UUID.h>
#include "../AssignmentClient.h" #include "../AssignmentClient.h"
@ -252,7 +253,7 @@ OctreeServer::OctreeServer(const QByteArray& packet) :
// make sure the AccountManager has an Auth URL for payment redemptions // make sure the AccountManager has an Auth URL for payment redemptions
AccountManager::getInstance().setAuthURL(DEFAULT_NODE_AUTH_URL); AccountManager::getInstance().setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
} }
OctreeServer::~OctreeServer() { OctreeServer::~OctreeServer() {

View file

@ -27,6 +27,7 @@
#include <HifiConfigVariantMap.h> #include <HifiConfigVariantMap.h>
#include <HTTPConnection.h> #include <HTTPConnection.h>
#include <LogUtils.h> #include <LogUtils.h>
#include <NetworkingConstants.h>
#include <PacketHeaders.h> #include <PacketHeaders.h>
#include <SettingHandle.h> #include <SettingHandle.h>
#include <SharedUtil.h> #include <SharedUtil.h>
@ -181,7 +182,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 = DEFAULT_NODE_AUTH_URL; _oauthProviderURL = NetworkingConstants::METAVERSE_SERVER_URL;
} }
AccountManager& accountManager = AccountManager::getInstance(); AccountManager& accountManager = AccountManager::getInstance();

View file

@ -68,6 +68,7 @@
#include <MainWindow.h> #include <MainWindow.h>
#include <ModelEntityItem.h> #include <ModelEntityItem.h>
#include <NetworkAccessManager.h> #include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <OctalCode.h> #include <OctalCode.h>
#include <OctreeSceneStats.h> #include <OctreeSceneStats.h>
#include <PacketHeaders.h> #include <PacketHeaders.h>
@ -425,7 +426,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle); connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle);
// 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.setAuthURL(DEFAULT_NODE_AUTH_URL); accountManager.setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
UserActivityLogger::getInstance().launch(applicationVersion()); UserActivityLogger::getInstance().launch(applicationVersion());
// once the event loop has started, check and signal for an access token // once the event loop has started, check and signal for an access token

View file

@ -13,7 +13,7 @@
#include <qwebview.h> #include <qwebview.h>
#include <AccountManager.h> #include <AccountManager.h>
#include <LimitedNodeList.h> #include <NetworkingConstants.h>
#include "Application.h" #include "Application.h"
#include "DataWebPage.h" #include "DataWebPage.h"
@ -39,7 +39,7 @@ DataWebDialog* DataWebDialog::dialogForPath(const QString& path,
connect(dialogWebView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, connect(dialogWebView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared,
dialogWebView, &DataWebDialog::addJavascriptObjectsToWindow); dialogWebView, &DataWebDialog::addJavascriptObjectsToWindow);
QUrl dataWebUrl(DEFAULT_NODE_AUTH_URL); QUrl dataWebUrl(NetworkingConstants::METAVERSE_SERVER_URL);
dataWebUrl.setPath(path); dataWebUrl.setPath(path);
qDebug() << "Opening a data web dialog for" << dataWebUrl.toString(); qDebug() << "Opening a data web dialog for" << dataWebUrl.toString();

View file

@ -14,6 +14,7 @@
#include <QPushButton> #include <QPushButton>
#include <QPixmap> #include <QPixmap>
#include <NetworkingConstants.h>
#include <PathUtils.h> #include <PathUtils.h>
#include "Application.h" #include "Application.h"
@ -23,7 +24,7 @@
#include "LoginDialog.h" #include "LoginDialog.h"
#include "UIUtil.h" #include "UIUtil.h"
const QString FORGOT_PASSWORD_URL = "https://metaverse.highfidelity.com/users/password/new"; const QString FORGOT_PASSWORD_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/users/password/new";
LoginDialog::LoginDialog(QWidget* parent) : LoginDialog::LoginDialog(QWidget* parent) :
FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP), FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP),

View file

@ -36,8 +36,6 @@ const char SOLO_NODE_TYPES[2] = {
NodeType::AudioMixer NodeType::AudioMixer
}; };
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://metaverse.highfidelity.com");
LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short dtlsListenPort) : LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short dtlsListenPort) :
linkedDataCreateCallback(NULL), linkedDataCreateCallback(NULL),
_sessionUUID(), _sessionUUID(),

View file

@ -42,8 +42,6 @@ const quint64 NODE_SILENCE_THRESHOLD_MSECS = 2 * 1000;
extern const char SOLO_NODE_TYPES[2]; extern const char SOLO_NODE_TYPES[2];
extern const QUrl DEFAULT_NODE_AUTH_URL;
const char DEFAULT_ASSIGNMENT_SERVER_HOSTNAME[] = "localhost"; const char DEFAULT_ASSIGNMENT_SERVER_HOSTNAME[] = "localhost";
const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io"; const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io";

View file

@ -0,0 +1,21 @@
//
// NetworkingConstants.h
// libraries/networking/src
//
// Created by Stephen Birarda on 2015-03-31.
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_NetworkingConstants_h
#define hifi_NetworkingConstants_h
#include <QUrl.h>
namespace NetworkingConstants {
const QUrl METAVERSE_SERVER_URL = QUrl("https://metaverse.highfidelity.com");
}
#endif // hifi_NetworkingConstants_h

View file

@ -15,6 +15,7 @@
#include "AccountManager.h" #include "AccountManager.h"
#include "LimitedNodeList.h" #include "LimitedNodeList.h"
#include "NetworkingConstants.h"
#include "SharedUtil.h" #include "SharedUtil.h"
#include "OAuthNetworkAccessManager.h" #include "OAuthNetworkAccessManager.h"
@ -33,7 +34,8 @@ QNetworkReply* OAuthNetworkAccessManager::createRequest(QNetworkAccessManager::O
QIODevice* outgoingData) { QIODevice* outgoingData) {
AccountManager& accountManager = AccountManager::getInstance(); AccountManager& accountManager = AccountManager::getInstance();
if (accountManager.hasValidAccessToken() && req.url().host() == DEFAULT_NODE_AUTH_URL.host()) { if (accountManager.hasValidAccessToken()
&& req.url().host() == NetworkingConstants::METAVERSE_SERVER_URL.host()) {
QNetworkRequest authenticatedRequest(req); QNetworkRequest authenticatedRequest(req);
authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
authenticatedRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER, authenticatedRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER,

View file

@ -17,12 +17,13 @@
#include <qurlquery.h> #include <qurlquery.h>
#include <NetworkAccessManager.h> #include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <AccountManager.h> #include <AccountManager.h>
#include "XMLHttpRequestClass.h" #include "XMLHttpRequestClass.h"
#include "ScriptEngine.h" #include "ScriptEngine.h"
const QString METAVERSE_API_URL = "https://metaverse.highfidelity.com/api/"; const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/api/";
Q_DECLARE_METATYPE(QByteArray*) Q_DECLARE_METATYPE(QByteArray*)