Move metaverse server URL info into NetworkingConstants.h (for C++

code) and into shared.js (for JS code).
Modify references to the metaverse server from constants to
    references to the new central definitions.
This commit is contained in:
Robert Adams 2020-06-01 20:34:35 -07:00
parent 8b45d6b529
commit 3878ad6df6
14 changed files with 43 additions and 29 deletions

View file

@ -52,6 +52,7 @@ var URLs = {
// STABLE METAVERSE_URL: https://metaverse.highfidelity.com
// STAGING METAVERSE_URL: https://staging.highfidelity.com
METAVERSE_URL: 'https://metaverse.highfidelity.com',
CDN_URL: 'https://cdn.highfidelity.com',
PLACE_URL: 'https://hifi.place',
};

View file

@ -70,13 +70,7 @@ const QString DomainServer::REPLACEMENT_FILE_EXTENSION = ".replace";
int const DomainServer::EXIT_CODE_REBOOT = 234923;
#if USE_STABLE_GLOBAL_SERVICES
const QString ICE_SERVER_DEFAULT_HOSTNAME = "ice.highfidelity.com";
#else
const QString ICE_SERVER_DEFAULT_HOSTNAME = "dev-ice.highfidelity.com";
#endif
QString DomainServer::_iceServerAddr { ICE_SERVER_DEFAULT_HOSTNAME };
QString DomainServer::_iceServerAddr { NetworkingConstants::ICE_SERVER_DEFAULT_HOSTNAME };
int DomainServer::_iceServerPort { ICE_SERVER_DEFAULT_PORT };
bool DomainServer::_overrideDomainID { false };
QUuid DomainServer::_overridingDomainID;

View file

@ -347,7 +347,6 @@ static const QString STANDARD_TO_ACTION_MAPPING_NAME = "Standard to Action";
static const QString NO_MOVEMENT_MAPPING_NAME = "Standard to Action (No Movement)";
static const QString NO_MOVEMENT_MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/standard_nomovement.json";
static const QString MARKETPLACE_CDN_HOSTNAME = "mpassets.highfidelity.com";
static const int INTERVAL_TO_CHECK_HMD_WORN_STATUS = 500; // milliseconds
static const QString DESKTOP_DISPLAY_PLUGIN_NAME = "Desktop";
static const QString ACTIVE_DISPLAY_PLUGIN_SETTING_NAME = "activeDisplayPlugin";
@ -7620,7 +7619,7 @@ bool Application::askToLoadScript(const QString& scriptFilenameOrURL) {
QUrl scriptURL { scriptFilenameOrURL };
if (scriptURL.host().endsWith(MARKETPLACE_CDN_HOSTNAME)) {
if (scriptURL.host().endsWith(NetworkingConstants::MARKETPLACE_CDN_HOSTNAME)) {
int startIndex = shortName.lastIndexOf('/') + 1;
int endIndex = shortName.lastIndexOf('?');
shortName = shortName.mid(startIndex, endIndex - startIndex);
@ -7743,7 +7742,7 @@ bool Application::askToReplaceDomainContent(const QString& url) {
const int MAX_CHARACTERS_PER_LINE = 90;
if (DependencyManager::get<NodeList>()->getThisNodeCanReplaceContent()) {
QUrl originURL { url };
if (originURL.host().endsWith(MARKETPLACE_CDN_HOSTNAME)) {
if (originURL.host().endsWith(NetworkingConstants::MARKETPLACE_CDN_HOSTNAME)) {
// Create a confirmation dialog when this call is made
static const QString infoText = simpleWordWrap("Your domain's content will be replaced with a new content set. "
"If you want to save what you have now, create a backup before proceeding. For more information about backing up "

View file

@ -799,19 +799,19 @@ Menu::Menu() {
// Help > Vircadia Docs
action = addActionToQMenuAndActionHash(helpMenu, "Online Documentation");
connect(action, &QAction::triggered, qApp, [] {
QDesktopServices::openUrl(QUrl("https://docs.vircadia.dev/"));
QDesktopServices::openUrl(NetworkingConstants::HELP_DOCS_URL);
});
// Help > Vircadia Forum
/* action = addActionToQMenuAndActionHash(helpMenu, "Online Forums");
connect(action, &QAction::triggered, qApp, [] {
QDesktopServices::openUrl(QUrl("https://forums.highfidelity.com/"));
QDesktopServices::openUrl(NetworkingConstants::HELP_FORUM_URL));
}); */
// Help > Scripting Reference
action = addActionToQMenuAndActionHash(helpMenu, "Online Script Reference");
connect(action, &QAction::triggered, qApp, [] {
QDesktopServices::openUrl(QUrl("https://apidocs.vircadia.dev/"));
QDesktopServices::openUrl(NetworkingConstants::HELP_SCRIPTING_REFERENCE_URL);
});
addActionToQMenuAndActionHash(helpMenu, "Controls Reference", 0, qApp, SLOT(showHelp()));
@ -821,13 +821,13 @@ Menu::Menu() {
// Help > Release Notes
action = addActionToQMenuAndActionHash(helpMenu, "Release Notes");
connect(action, &QAction::triggered, qApp, [] {
QDesktopServices::openUrl(QUrl("https://docs.vircadia.dev/release-notes.html"));
QDesktopServices::openUrl(NetworkingConstants::HELP_RELEASE_NOTES_URL);
});
// Help > Report a Bug!
action = addActionToQMenuAndActionHash(helpMenu, "Report a Bug!");
connect(action, &QAction::triggered, qApp, [] {
QDesktopServices::openUrl(QUrl("https://github.com/kasenvr/project-athena/issues"));
QDesktopServices::openUrl(NetworkingConstants::HELP_BUG_REPORT_URL);
});
}

View file

@ -16,6 +16,7 @@
#include <ApplicationVersion.h>
#include <BuildInfo.h>
#include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <SharedUtil.h>
AutoUpdater::AutoUpdater() :
@ -36,18 +37,15 @@ void AutoUpdater::checkForUpdate() {
this->getLatestVersionData();
}
const QUrl BUILDS_XML_URL("https://highfidelity.com/builds.xml");
const QUrl MASTER_BUILDS_XML_URL("https://highfidelity.com/dev-builds.xml");
void AutoUpdater::getLatestVersionData() {
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
QUrl buildsURL;
if (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable) {
buildsURL = BUILDS_XML_URL;
buildsURL = NetworkingConstants::BUILDS_XML_URL;
} else if (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master) {
buildsURL = MASTER_BUILDS_XML_URL;
buildsURL = NetworkingConstants::MASTER_BUILDS_XML_URL;
}
QNetworkRequest latestVersionRequest(buildsURL);

View file

@ -27,6 +27,28 @@ namespace NetworkingConstants {
const QUrl METAVERSE_SERVER_URL_STABLE { "https://metaverse.highfidelity.com" };
const QUrl METAVERSE_SERVER_URL_STAGING { "https://staging-metaverse.vircadia.com" };
// Web Engine requests to this parent domain have an account authorization header added
const QString AUTH_HOSTNAME_BASE = "highfidelity.com";
const QUrl BUILDS_XML_URL("https://highfidelity.com/builds.xml");
const QUrl MASTER_BUILDS_XML_URL("https://highfidelity.com/dev-builds.xml");
#if USE_STABLE_GLOBAL_SERVICES
const QString ICE_SERVER_DEFAULT_HOSTNAME = "ice.highfidelity.com";
#else
const QString ICE_SERVER_DEFAULT_HOSTNAME = "dev-ice.highfidelity.com";
#endif
const QString MARKETPLACE_CDN_HOSTNAME = "mpassets.highfidelity.com";
const QUrl HELP_DOCS_URL { "https://docs.vircadia.dev" };
const QUrl HELP_FORUM_URL { "https://forums.vircadia.dev" };
const QUrl HELP_SCRIPTING_REFERENCE_URL{ "https://apidocs.vircadia.dev/" };
const QUrl HELP_RELEASE_NOTES_URL{ "https://docs.vircadia.dev/release-notes.html" };
const QUrl HELP_BUG_REPORT_URL{ "https://github.com/kasenvr/project-athena/issues" };
}
const QString HIFI_URL_SCHEME_ABOUT = "about";

View file

@ -29,7 +29,7 @@ namespace {
auto metaverseServerURL = MetaverseAPI::getCurrentMetaverseServerURL();
static const QStringList HF_HOSTS = {
"highfidelity.com", "highfidelity.io",
metaverseServerURL.toString(), "metaverse.highfidelity.io"
metaverseServerURL.toString(),
};
const auto& scheme = url.scheme();
const auto& host = url.host();

View file

@ -155,7 +155,7 @@ var avatars = {};
function changeLobbyTextures() {
var req = new XMLHttpRequest();
req.open("GET", "https://metaverse.highfidelity.com/api/v1/marketplace?category=head+%26+body&limit=21", false);
req.open("GET", URLs.METAVERSE_URL + "/api/v1/marketplace?category=head+%26+body&limit=21", false);
req.send(); // Data returned is randomized.
avatars = JSON.parse(req.responseText).data.items;

View file

@ -21,8 +21,8 @@
var START_MESSAGE = "recordingStarted";
var STOP_MESSAGE = "recordingEnded";
var PARTICIPATING_MESSAGE = "participatingToRecording";
var RECORDING_ICON_URL = "http://cdn.highfidelity.com/alan/production/icons/ICO_rec-active.svg";
var NOT_RECORDING_ICON_URL = "http://cdn.highfidelity.com/alan/production/icons/ICO_rec-inactive.svg";
var RECORDING_ICON_URL = URLs.CDN_URL + "/alan/production/icons/ICO_rec-active.svg";
var NOT_RECORDING_ICON_URL = URLs.CDN_URL + "/alan/production/icons/ICO_rec-inactive.svg";
var ICON_WIDTH = 60;
var ICON_HEIGHT = 60;
var overlay = null;

View file

@ -153,7 +153,7 @@ var places = {};
function changeLobbyTextures() {
var req = new XMLHttpRequest();
req.open("GET", "https://metaverse.highfidelity.com/api/v1/places?limit=21", false);
req.open("GET", URLs.METAVERSE_URL + "/api/v1/places?limit=21", false);
req.send();
places = JSON.parse(req.responseText).data.places;

View file

@ -14,7 +14,7 @@
const GAME_CHANNEL = 'winterSmashUpGame';
const SCORE_POST_URL = 'https://script.google.com/macros/s/AKfycbwZAMx6cMBx6-8NGEhR8ELUA-dldtpa_4P55z38Q4vYHW6kneg/exec';
const MODEL_URL = 'http://cdn.highfidelity.com/chris/production/winter/game/';
const MODEL_URL = URLs.CDN_URL + '/chris/production/winter/game/';
const MAX_GAME_TIME = 120; //seconds
const TARGET_CLOSE_OFFSET = 0.5;
const MILLISECS_IN_SEC = 1000;

View file

@ -440,7 +440,7 @@ function updateShareInfo(containerID, storyID) {
}
var shareBar = document.getElementById(containerID + "shareBar"),
parentDiv = document.getElementById(containerID),
shareURL = "https://highfidelity.com/user_stories/" + storyID,
shareURL = URLs.METAVERSE_URL + "/user_stories/" + storyID,
facebookButton = document.getElementById(containerID + "facebookButton"),
twitterButton = document.getElementById(containerID + "twitterButton");

View file

@ -56,7 +56,7 @@ const menuNotificationIcon = path.join(__dirname, '../resources/tray-menu-notifi
const DELETE_LOG_FILES_OLDER_THAN_X_SECONDS = 60 * 60 * 24 * 7; // 7 Days
const LOG_FILE_REGEX = /(domain-server|ac-monitor|ac)-.*-std(out|err).txt/;
const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-RC40.tar.gz";
const HOME_CONTENT_URL = URLs.CDN_URL + "/content-sets/home-tutorial-RC40.tar.gz";
const buildInfo = GetBuildInfo();

View file

@ -19,7 +19,7 @@ const MARKETPLACE_NOTIFICATION_POLL_TIME_MS = 600 * 1000;
const OSX_CLICK_DELAY_TIMEOUT = 500;
const METAVERSE_SERVER_URL= process.env.HIFI_METAVERSE_URL ? process.env.HIFI_METAVERSE_URL : 'https://metaverse.highfidelity.com'
const METAVERSE_SERVER_URL = process.env.HIFI_METAVERSE_URL ? process.env.HIFI_METAVERSE_URL : URLs.METAVERSE_URL
const STORIES_URL= '/api/v1/user_stories';
const USERS_URL= '/api/v1/users';
const ECONOMIC_ACTIVITY_URL= '/api/v1/commerce/history';