From f4016bb0d57502704778cdec3f3e526fa8b043f1 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Tue, 21 Jul 2020 02:36:55 -0400 Subject: [PATCH] Add API call to retrieve user agent. --- interface/src/scripting/WindowScriptingInterface.cpp | 5 +++++ interface/src/scripting/WindowScriptingInterface.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index f4aa36e2f4..434adf0bc8 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -29,6 +29,7 @@ #include "Menu.h" #include "OffscreenUi.h" #include "commerce/QmlCommerce.h" +#include "NetworkingConstants.h" static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); static const QString LAST_BROWSE_LOCATION_SETTING = "LastBrowseLocation"; @@ -411,6 +412,10 @@ QString WindowScriptingInterface::checkVersion() { return QCoreApplication::applicationVersion(); } +QString WindowScriptingInterface::getUserAgent() { + return NetworkingConstants::VIRCADIA_USER_AGENT; +} + QString WindowScriptingInterface::protocolSignature() { return protocolVersionsSignatureBase64(); } diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 0c2fdd1614..28a725f3cb 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -295,6 +295,13 @@ public slots: */ QString checkVersion(); + /**jsdoc + * Gets Interface's user agent. + * @function Window.getUserAgent + * @returns {string} Interface's user agent. + */ + QString getUserAgent(); + /**jsdoc * Gets the signature for Interface's protocol version. * @function Window.protocolSignature