Merge pull request #11670 from zfox23/stagingSetting

Make it easier to switch between STABLE and STAGING Metaverses
This commit is contained in:
Zach Fox 2017-10-27 12:03:29 -07:00 committed by GitHub
commit 3fae121335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 53 additions and 51 deletions

View file

@ -22,7 +22,6 @@
#include <HTTPConnection.h>
#include <LogHandler.h>
#include <shared/NetworkUtils.h>
#include <NetworkingConstants.h>
#include <NumericalConstants.h>
#include <UUID.h>

View file

@ -1,5 +1,7 @@
var Settings = {
showAdvanced: false,
// STABLE METAVERSE_URL: https://metaverse.highfidelity.com
// STAGING METAVERSE_URL: https://staging.highfidelity.com
METAVERSE_URL: 'https://metaverse.highfidelity.com',
ADVANCED_CLASS: 'advanced-setting',
DEPRECATED_CLASS: 'deprecated-setting',

View file

@ -87,7 +87,7 @@ Window {
onReceivedHifiSchemeURL: resetAfterTeleport();
// Update location after using back and forward buttons.
onMetaverseServerUrlChanged: updateLocationTextTimer.start();
onHostChanged: updateLocationTextTimer.start();
ListModel { id: suggestions }

View file

@ -33,7 +33,7 @@ Window {
BaseWebView {
id: webview
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
url: Account.metaverseServerURL + "/marketplace?category=avatars"
focus: true
anchors {

View file

@ -17,7 +17,7 @@ import "../styles-uit"
import "../controls-uit" as HifiControls
import "toolbars"
// references Users, UserActivityLogger, MyAvatar, Vec3, Quat, AddressManager from root context
// references Users, UserActivityLogger, MyAvatar, Vec3, Quat, AddressManager, Account from root context
Item {
id: thisNameCard
@ -30,7 +30,6 @@ Item {
// Properties
property string profileUrl: "";
property string defaultBaseUrl: AddressManager.metaverseServerUrl;
property string connectionStatus : ""
property string uuid: ""
property string displayName: ""
@ -59,7 +58,7 @@ Item {
clip: true
Image {
id: userImage
source: profileUrl !== "" ? ((0 === profileUrl.indexOf("http")) ? profileUrl : (defaultBaseUrl + profileUrl)) : "";
source: profileUrl !== "" ? ((0 === profileUrl.indexOf("http")) ? profileUrl : (Account.metaverseServerURL + profileUrl)) : "";
mipmap: true;
// Anchors
anchors.fill: parent
@ -95,7 +94,7 @@ Item {
enabled: (selected && activeTab == "nearbyTab") || isMyCard;
hoverEnabled: enabled
onClicked: {
userInfoViewer.url = defaultBaseUrl + "/users/" + userName;
userInfoViewer.url = Account.metaverseServerURL + "/users/" + userName;
userInfoViewer.visible = true;
}
onEntered: infoHoverImage.visible = true;
@ -366,7 +365,7 @@ Item {
enabled: selected
hoverEnabled: true
onClicked: {
userInfoViewer.url = defaultBaseUrl + "/users/" + userName;
userInfoViewer.url = Account.metaverseServerURL + "/users/" + userName;
userInfoViewer.visible = true;
}
onEntered: {

View file

@ -23,9 +23,6 @@ import "../controls" as HifiControls
Rectangle {
id: pal;
// Size
width: parent.width;
height: parent.height;
// Style
color: "#E3E3E3";
// Properties

View file

@ -25,7 +25,7 @@ Item {
HifiConstants { id: hifi; }
id: root;
property string referrerURL: "https://metaverse.highfidelity.com/marketplace?";
property string referrerURL: (Account.metaverseServerURL + "/marketplace?");
readonly property int additionalDropdownHeight: usernameDropdown.height - myUsernameButton.anchors.bottomMargin;
property alias usernameDropdownVisible: usernameDropdown.visible;

View file

@ -134,7 +134,7 @@ StackView {
bottom: parent.bottom
}
onMetaverseServerUrlChanged: updateLocationTextTimer.start();
onHostChanged: updateLocationTextTimer.start();
Rectangle {
id: navBar
width: parent.width

View file

@ -31,7 +31,7 @@ Item {
BaseWebView {
id: webview
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
url: (Account.metaverseServerURL + "/marketplace?category=avatars)"
focus: true
anchors {

View file

@ -25,6 +25,11 @@ class AccountScriptingInterface : public QObject {
* @property username {String} username if user is logged in, otherwise it returns "Unknown user"
*/
public:
Q_PROPERTY(QUrl metaverseServerURL READ getMetaverseServerURL)
QUrl getMetaverseServerURL() { return DependencyManager::get<AccountManager>()->getMetaverseServerURL(); }
signals:
/**jsdoc

View file

@ -39,7 +39,7 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare
});
_backEnabled = !(DependencyManager::get<AddressManager>()->getBackStack().isEmpty());
_forwardEnabled = !(DependencyManager::get<AddressManager>()->getForwardStack().isEmpty());
connect(addressManager.data(), &AddressManager::hostChanged, this, &AddressBarDialog::metaverseServerUrlChanged);
connect(addressManager.data(), &AddressManager::hostChanged, this, &AddressBarDialog::hostChanged);
connect(DependencyManager::get<DialogsManager>().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed);
connect(qApp, &Application::receivedHifiSchemeURL, this, &AddressBarDialog::receivedHifiSchemeURL);
}

View file

@ -22,7 +22,7 @@ class AddressBarDialog : public OffscreenQmlDialog {
Q_PROPERTY(bool backEnabled READ backEnabled NOTIFY backEnabledChanged)
Q_PROPERTY(bool forwardEnabled READ forwardEnabled NOTIFY forwardEnabledChanged)
Q_PROPERTY(bool useFeed READ useFeed WRITE setUseFeed NOTIFY useFeedChanged)
Q_PROPERTY(QString metaverseServerUrl READ metaverseServerUrl NOTIFY metaverseServerUrlChanged)
Q_PROPERTY(QString metaverseServerUrl READ metaverseServerUrl)
public:
AddressBarDialog(QQuickItem* parent = nullptr);
@ -37,7 +37,7 @@ signals:
void forwardEnabledChanged();
void useFeedChanged();
void receivedHifiSchemeURL(const QString& url);
void metaverseServerUrlChanged();
void hostChanged();
protected:
void displayAddressOfflineMessage();

View file

@ -16,7 +16,6 @@
#include <QtCore/QJsonDocument>
#include <QtNetwork/QNetworkReply>
#include <NetworkingConstants.h>
#include <plugins/PluginManager.h>
#include <plugins/SteamClientPlugin.h>
#include <ui/TabletScriptingInterface.h>

View file

@ -11,7 +11,6 @@
#include <AudioClient.h>
#include <avatar/AvatarManager.h>
#include <devices/DdeFaceTracker.h>
#include <NetworkingConstants.h>
#include <ScriptEngines.h>
#include <OffscreenUi.h>
#include <Preferences.h>

View file

@ -15,7 +15,6 @@
#include <QNetworkRequest>
#include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <SharedUtil.h>
#include "FSTReader.h"

View file

@ -28,7 +28,6 @@
#include <SettingHandle.h>
#include "NetworkingConstants.h"
#include "NetworkLogging.h"
#include "NodeList.h"
#include "udt/PacketHeaders.h"
@ -240,7 +239,7 @@ void AccountManager::sendRequest(const QString& path,
QUrl requestURL = _authURL;
if (requestURL.isEmpty()) { // Assignment client doesn't set _authURL.
requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
requestURL = getMetaverseServerURL();
}
if (path.startsWith("/")) {

View file

@ -18,6 +18,7 @@
#include <QtNetwork/QNetworkReply>
#include <QUrlQuery>
#include "NetworkingConstants.h"
#include "NetworkAccessManager.h"
#include "DataServerAccountInfo.h"
@ -96,6 +97,8 @@ public:
void setTemporaryDomain(const QUuid& domainID, const QString& key);
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
QUrl getMetaverseServerURL() { return NetworkingConstants::METAVERSE_SERVER_URL; }
public slots:
void requestAccessToken(const QString& login, const QString& password);
void requestAccessTokenWithSteam(QByteArray authSessionTicket);

View file

@ -24,7 +24,6 @@
#include "AddressManager.h"
#include "NodeList.h"
#include "NetworkingConstants.h"
#include "NetworkLogging.h"
#include "UserActivityLogger.h"
#include "udt/PacketHeaders.h"
@ -770,10 +769,6 @@ QString AddressManager::getDomainId() const {
return DependencyManager::get<NodeList>()->getDomainHandler().getUUID().toString();
}
const QUrl AddressManager::getMetaverseServerUrl() const {
return NetworkingConstants::METAVERSE_SERVER_URL;
}
void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) {
// make sure that this response is for the domain we're currently connected to
auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();

View file

@ -41,7 +41,6 @@ class AddressManager : public QObject, public Dependency {
Q_PROPERTY(QString pathname READ currentPath)
Q_PROPERTY(QString placename READ getPlaceName)
Q_PROPERTY(QString domainId READ getDomainId)
Q_PROPERTY(QUrl metaverseServerUrl READ getMetaverseServerUrl NOTIFY metaverseServerUrlChanged)
public:
Q_INVOKABLE QString protocolVersion();
using PositionGetter = std::function<glm::vec3()>;
@ -71,7 +70,6 @@ public:
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
const QString& getPlaceName() const { return _shareablePlaceName.isEmpty() ? _placeName : _shareablePlaceName; }
QString getDomainId() const;
const QUrl getMetaverseServerUrl() const;
const QString& getHost() const { return _host; }
@ -123,8 +121,6 @@ signals:
void goBackPossible(bool isPossible);
void goForwardPossible(bool isPossible);
void metaverseServerUrlChanged();
protected:
AddressManager();
private slots:

View file

@ -15,7 +15,12 @@
#include <QtCore/QUrl>
namespace NetworkingConstants {
const QUrl METAVERSE_SERVER_URL = QUrl("https://metaverse.highfidelity.com");
// If you want to use STAGING instead of STABLE,
// don't forget to ALSO change the Domain Server Metaverse Server URL, which is at the top of:
// <hifi repo>\domain-server\resources\web\settings\js\settings.js
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 = METAVERSE_SERVER_URL_STABLE;
}
#endif // hifi_NetworkingConstants_h

View file

@ -20,15 +20,16 @@
namespace {
bool isAuthableHighFidelityURL(const QUrl& url) {
auto metaverseServerURL = NetworkingConstants::METAVERSE_SERVER_URL;
static const QStringList HF_HOSTS = {
"highfidelity.com", "highfidelity.io",
"metaverse.highfidelity.com", "metaverse.highfidelity.io"
metaverseServerURL.toString(), "metaverse.highfidelity.io"
};
const auto& scheme = url.scheme();
const auto& host = url.host();
return (scheme == "https" && HF_HOSTS.contains(host)) ||
((scheme == NetworkingConstants::METAVERSE_SERVER_URL.scheme()) && (host == NetworkingConstants::METAVERSE_SERVER_URL.host()));
((scheme == metaverseServerURL.scheme()) && (host == metaverseServerURL.host()));
}
bool isScript(const QString filename) {

View file

@ -16,7 +16,7 @@
(function () { // BEGIN LOCAL_SCOPE
Script.include("/~/system/libraries/accountUtils.js");
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
// Function Name: onButtonClicked()
//

View file

@ -15,7 +15,7 @@ Script.include([
var toolIconUrl = Script.resolvePath("assets/images/tools/");
var DIRECTORY_WINDOW_URL = "https://metaverse.highfidelity.com/directory";
var DIRECTORY_WINDOW_URL = Account.metaverseServerURL + "/directory";
var directoryWindow = new OverlayWebWindow({
title: 'Directory',
source: "about:blank",

View file

@ -163,7 +163,7 @@ var importingSVOTextOverlay = Overlays.addOverlay("text", {
visible: false
});
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
var marketplaceWindow = new OverlayWebWindow({
title: 'Marketplace',
source: "about:blank",

View file

@ -29,6 +29,7 @@
var commerceMode = false;
var userIsLoggedIn = false;
var walletNeedsSetup = false;
var metaverseServerURL = "https://metaverse.highfidelity.com";
function injectCommonCode(isDirectoryPage) {
@ -57,7 +58,7 @@
);
// Footer.
var isInitialHiFiPage = location.href === "https://metaverse.highfidelity.com/marketplace?";
var isInitialHiFiPage = location.href === metaverseServerURL + "/marketplace?";
$("body").append(
'<div id="marketplace-navigation">' +
(!isInitialHiFiPage ? '<input id="back-button" type="button" class="white" value="&lt; Back" />' : '') +
@ -69,7 +70,7 @@
// Footer actions.
$("#back-button").on("click", function () {
(document.referrer !== "") ? window.history.back() : window.location = "https://metaverse.highfidelity.com/marketplace?";
(document.referrer !== "") ? window.history.back() : window.location = (metaverseServerURL + "/marketplace?");
});
$("#all-markets").on("click", function () {
EventBridge.emitWebEvent(GOTO_DIRECTORY);
@ -641,6 +642,7 @@
commerceMode = !!parsedJsonMessage.data.commerceMode;
userIsLoggedIn = !!parsedJsonMessage.data.userIsLoggedIn;
walletNeedsSetup = !!parsedJsonMessage.data.walletNeedsSetup;
metaverseServerURL = parsedJsonMessage.data.metaverseServerURL;
injectCode();
}
}

View file

@ -444,7 +444,7 @@
}, WAITING_INTERVAL);
}
var pollCount = 0, requestUrl = location.metaverseServerUrl + '/api/v1/user/connection_request';
var pollCount = 0, requestUrl = Account.metaverseServerURL + '/api/v1/user/connection_request';
// As currently implemented, we select the closest waiting avatar (if close enough) and send
// them a connectionRequest. If nobody is close enough we send a waiting message, and wait for a
// connectionRequest. If the 2 people who want to connect are both somewhat out of range when they
@ -569,7 +569,7 @@
// IWBNI we also did some fail sound/visual effect.
Window.makeConnection(false, result.connection);
if (Account.isLoggedIn()) { // Give extra failure info
request(location.metaverseServerUrl + '/api/v1/users/' + Account.username + '/location', function (error, response) {
request(Account.metaverseServerURL + '/api/v1/users/' + Account.username + '/location', function (error, response) {
var message = '';
if (error || response.status !== 'success') {
message = 'Unable to get location.';

View file

@ -15,7 +15,7 @@ Script.include("../libraries/WebTablet.js");
var toolIconUrl = Script.resolvePath("../assets/images/tools/");
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
var marketplaceWindow = new OverlayWebWindow({
title: "Marketplace",
source: "about:blank",

View file

@ -15,7 +15,8 @@
Script.include("../libraries/WebTablet.js");
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var METAVERSE_SERVER_URL = Account.metaverseServerURL;
var MARKETPLACE_URL = METAVERSE_SERVER_URL + "/marketplace";
var MARKETPLACE_URL_INITIAL = MARKETPLACE_URL + "?"; // Append "?" to signal injected script that it's the initial page.
var MARKETPLACES_URL = Script.resolvePath("../html/marketplaces.html");
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("../html/js/marketplacesInject.js");
@ -135,7 +136,7 @@
function setCertificateInfo(currentEntityWithContextOverlay, itemCertificateId) {
wireEventBridge(true);
var certificateId = itemCertificateId || (Entities.getEntityProperties(currentEntityWithContextOverlay, ['certificateID']).certificateID + "\n");
var certificateId = itemCertificateId || (Entities.getEntityProperties(currentEntityWithContextOverlay, ['certificateID']).certificateID);
tablet.sendToQml({
method: 'inspectionCertificate_setCertificateId',
certificateId: certificateId
@ -155,7 +156,8 @@
data: {
commerceMode: Settings.getValue("commerce", false),
userIsLoggedIn: Account.loggedIn,
walletNeedsSetup: Wallet.walletStatus === 1
walletNeedsSetup: Wallet.walletStatus === 1,
metaverseServerURL: Account.metaverseServerURL
}
}));
}

View file

@ -334,7 +334,7 @@ function updateUser(data) {
// User management services
//
// These are prototype versions that will be changed when the back end changes.
var METAVERSE_BASE = location.metaverseServerUrl;
var METAVERSE_BASE = Account.metaverseServerURL;
function requestJSON(url, callback) { // callback(data) if successfull. Logs otherwise.
request({

View file

@ -35,7 +35,7 @@ var imageData = [];
var storyIDsToMaybeDelete = [];
var shareAfterLogin = false;
var snapshotToShareAfterLogin = [];
var METAVERSE_BASE = location.metaverseServerUrl;
var METAVERSE_BASE = Account.metaverseServerURL;
var isLoggedIn;
var numGifSnapshotUploadsPending = 0;
var numStillSnapshotUploadsPending = 0;

View file

@ -115,7 +115,7 @@
var stories = {}, pingPong = false;
function expire(id) {
var options = {
uri: location.metaverseServerUrl + '/api/v1/user_stories/' + id,
uri: Account.metaverseServerURL + '/api/v1/user_stories/' + id,
method: 'PUT',
json: true,
body: {expire: "true"}
@ -139,7 +139,7 @@
'protocol=' + encodeURIComponent(location.protocolVersion()),
'per_page=' + count
];
var url = location.metaverseServerUrl + '/api/v1/user_stories?' + options.join('&');
var url = Account.metaverseServerURL + '/api/v1/user_stories?' + options.join('&');
request({
uri: url
}, function (error, data) {

View file

@ -14,7 +14,7 @@
var USERS_URL = "https://hifi-content.s3.amazonaws.com/faye/tablet-dev/users.html";
var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
var FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";
var FRIENDS_WINDOW_URL = Account.metaverseServerURL + "/user/friends";
var FRIENDS_WINDOW_WIDTH = 290;
var FRIENDS_WINDOW_HEIGHT = 500;
var FRIENDS_WINDOW_TITLE = "Add/Remove Friends";

View file

@ -6,7 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var SERVER = 'https://metaverse.highfidelity.com/api/v1';
var SERVER = Account.metaverseServerURL + '/api/v1';
var OVERLAY = null;