mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-02 00:39:52 +02:00
optionally include the metaverse session ID as an http header
This commit is contained in:
parent
b8b39b962d
commit
66bdbf910d
3 changed files with 19 additions and 2 deletions
|
@ -127,6 +127,10 @@ void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply
|
||||||
|
|
||||||
if (!dataObject.isEmpty()) {
|
if (!dataObject.isEmpty()) {
|
||||||
_sessionID = dataObject[SESSION_ID_KEY].toString();
|
_sessionID = dataObject[SESSION_ID_KEY].toString();
|
||||||
|
|
||||||
|
// give that session ID to the account manager
|
||||||
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
accountManager->setSessionID(_sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// 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
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "AccountManager.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QtCore/QDataStream>
|
#include <QtCore/QDataStream>
|
||||||
|
@ -26,13 +28,13 @@
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
|
#include "NetworkLogging.h"
|
||||||
#include "NodeList.h"
|
#include "NodeList.h"
|
||||||
#include "udt/PacketHeaders.h"
|
#include "udt/PacketHeaders.h"
|
||||||
#include "RSAKeypairGenerator.h"
|
#include "RSAKeypairGenerator.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "NetworkLogging.h"
|
|
||||||
|
|
||||||
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
||||||
|
|
||||||
|
@ -216,6 +218,13 @@ void AccountManager::sendRequest(const QString& path,
|
||||||
|
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
|
// if we're allowed to send usage data, include whatever the current session ID is with this request
|
||||||
|
auto& activityLogger = UserActivityLogger::getInstance();
|
||||||
|
if (activityLogger.isEnabled()) {
|
||||||
|
static const QString METAVERSE_SESSION_ID_HEADER = "HFM-SessionID";
|
||||||
|
networkRequest.setRawHeader(METAVERSE_SESSION_ID_HEADER.toLocal8Bit(), _sessionID.toString().toLocal8Bit());
|
||||||
|
}
|
||||||
|
|
||||||
QUrl requestURL = _authURL;
|
QUrl requestURL = _authURL;
|
||||||
|
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
|
|
|
@ -86,6 +86,8 @@ public:
|
||||||
|
|
||||||
static QJsonObject dataObjectFromResponse(QNetworkReply& requestReply);
|
static QJsonObject dataObjectFromResponse(QNetworkReply& requestReply);
|
||||||
|
|
||||||
|
void setSessionID(const QUuid& sessionID) { _sessionID = sessionID; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestAccessToken(const QString& login, const QString& password);
|
void requestAccessToken(const QString& login, const QString& password);
|
||||||
|
|
||||||
|
@ -136,6 +138,8 @@ private:
|
||||||
|
|
||||||
bool _isWaitingForKeypairResponse { false };
|
bool _isWaitingForKeypairResponse { false };
|
||||||
QByteArray _pendingPrivateKey;
|
QByteArray _pendingPrivateKey;
|
||||||
|
|
||||||
|
QUuid _sessionID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AccountManager_h
|
#endif // hifi_AccountManager_h
|
||||||
|
|
Loading…
Reference in a new issue