mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 15:58:31 +02:00
allow temporary domain to upload public key
This commit is contained in:
parent
3a800350c9
commit
0191d75e86
3 changed files with 16 additions and 9 deletions
|
@ -778,7 +778,7 @@ function chooseFromHighFidelityDomains(clickedButton) {
|
||||||
function createTemporaryDomain() {
|
function createTemporaryDomain() {
|
||||||
swal({
|
swal({
|
||||||
title: 'Create temporary place name',
|
title: 'Create temporary place name',
|
||||||
text: "This will create a temporary place name and domain ID (valid for 30 days)"
|
text: "This will create a temporary place name and domain ID"
|
||||||
+ " so other users can easily connect to your domain.</br></br>"
|
+ " so other users can easily connect to your domain.</br></br>"
|
||||||
+ "In order to make your domain reachable, this will also enable full automatic networking.",
|
+ "In order to make your domain reachable, this will also enable full automatic networking.",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
|
|
|
@ -110,7 +110,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
|
|
||||||
// preload some user public keys so they can connect on first request
|
// preload some user public keys so they can connect on first request
|
||||||
_gatekeeper.preloadAllowedUserPublicKeys();
|
_gatekeeper.preloadAllowedUserPublicKeys();
|
||||||
|
|
||||||
optionallyGetTemporaryName(args);
|
optionallyGetTemporaryName(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,9 +393,10 @@ bool DomainServer::resetAccountManagerAccessToken() {
|
||||||
if (accessTokenVariant && accessTokenVariant->canConvert(QMetaType::QString)) {
|
if (accessTokenVariant && accessTokenVariant->canConvert(QMetaType::QString)) {
|
||||||
accessToken = accessTokenVariant->toString();
|
accessToken = accessTokenVariant->toString();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "A domain-server feature that requires authentication is enabled but no access token is present."
|
qDebug() << "A domain-server feature that requires authentication is enabled but no access token is present.";
|
||||||
<< "Set an access token via the web interface, in your user or master config"
|
qDebug() << "Set an access token via the web interface, in your user or master config"
|
||||||
<< "at keypath metaverse.access_token or in your ENV at key DOMAIN_SERVER_ACCESS_TOKEN";
|
<< "at keypath metaverse.access_token or in your ENV at key DOMAIN_SERVER_ACCESS_TOKEN";
|
||||||
|
AccountManager::getInstance().setAccessTokenForCurrentAuthURL(QString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -432,8 +433,8 @@ void DomainServer::setupAutomaticNetworking() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetAccountManagerAccessToken()) {
|
if (!resetAccountManagerAccessToken()) {
|
||||||
qDebug() << "Cannot send heartbeat to data server without an access token.";
|
qDebug() << "Will not send heartbeat to Metaverse API without an access token.";
|
||||||
qDebug() << "Add an access token to your config file or via the web interface.";
|
qDebug() << "If this is not a temporary domain add an access token to your config file or via the web interface.";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -494,6 +495,8 @@ void DomainServer::setupICEHeartbeatForFullNetworking() {
|
||||||
auto& accountManager = AccountManager::getInstance();
|
auto& accountManager = AccountManager::getInstance();
|
||||||
auto domainID = accountManager.getAccountInfo().getDomainID();
|
auto domainID = accountManager.getAccountInfo().getDomainID();
|
||||||
|
|
||||||
|
// if we have an access token and we don't have a private key or the current domain ID has changed
|
||||||
|
// we should generate a new keypair
|
||||||
if (!accountManager.getAccountInfo().hasPrivateKey() || domainID != limitedNodeList->getSessionUUID()) {
|
if (!accountManager.getAccountInfo().hasPrivateKey() || domainID != limitedNodeList->getSessionUUID()) {
|
||||||
accountManager.generateNewDomainKeypair(limitedNodeList->getSessionUUID());
|
accountManager.generateNewDomainKeypair(limitedNodeList->getSessionUUID());
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,8 +450,12 @@ void AccountManager::setAccessTokenForCurrentAuthURL(const QString& accessToken)
|
||||||
// replace the account info access token with a new OAuthAccessToken
|
// replace the account info access token with a new OAuthAccessToken
|
||||||
OAuthAccessToken newOAuthToken;
|
OAuthAccessToken newOAuthToken;
|
||||||
newOAuthToken.token = accessToken;
|
newOAuthToken.token = accessToken;
|
||||||
|
|
||||||
qCDebug(networking) << "Setting new account manager access token. F2C:" << accessToken.left(2) << "L2C:" << accessToken.right(2);
|
if (!accessToken.isEmpty()) {
|
||||||
|
qCDebug(networking) << "Setting new AccountManager OAuth token. F2C:" << accessToken.left(2) << "L2C:" << accessToken.right(2);
|
||||||
|
} else if (!_accountInfo.getAccessToken().token.isEmpty()) {
|
||||||
|
qCDebug(networking) << "Clearing AccountManager OAuth token.";
|
||||||
|
}
|
||||||
|
|
||||||
_accountInfo.setAccessToken(newOAuthToken);
|
_accountInfo.setAccessToken(newOAuthToken);
|
||||||
|
|
||||||
|
@ -658,7 +662,7 @@ void AccountManager::processGeneratedKeypair() {
|
||||||
callbackParameters.errorCallbackReceiver = this;
|
callbackParameters.errorCallbackReceiver = this;
|
||||||
callbackParameters.errorCallbackMethod = "publicKeyUploadFailed";
|
callbackParameters.errorCallbackMethod = "publicKeyUploadFailed";
|
||||||
|
|
||||||
sendRequest(uploadPath, AccountManagerAuth::Required, QNetworkAccessManager::PutOperation,
|
sendRequest(uploadPath, AccountManagerAuth::Optional, QNetworkAccessManager::PutOperation,
|
||||||
callbackParameters, QByteArray(), requestMultiPart);
|
callbackParameters, QByteArray(), requestMultiPart);
|
||||||
|
|
||||||
keypairGenerator->deleteLater();
|
keypairGenerator->deleteLater();
|
||||||
|
|
Loading…
Reference in a new issue