mirror of
https://github.com/lubosz/overte.git
synced 2025-08-11 14:35:10 +02:00
Use useragent instead of queryparam to determine limitedCommerce
This commit is contained in:
parent
2b50c40224
commit
402c23e359
11 changed files with 21 additions and 30 deletions
|
@ -7881,9 +7881,6 @@ void Application::loadAvatarBrowser() const {
|
||||||
auto tablet = dynamic_cast<TabletProxy*>(DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
auto tablet = dynamic_cast<TabletProxy*>(DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
// construct the url to the marketplace item
|
// construct the url to the marketplace item
|
||||||
QString url = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace?category=avatars";
|
QString url = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace?category=avatars";
|
||||||
if (DependencyManager::get<WalletScriptingInterface>()->getLimitedCommerce()) {
|
|
||||||
url += "&isFree=1";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MARKETPLACES_INJECT_SCRIPT_PATH = "file:///" + qApp->applicationDirPath() + "/scripts/system/html/js/marketplacesInject.js";
|
QString MARKETPLACES_INJECT_SCRIPT_PATH = "file:///" + qApp->applicationDirPath() + "/scripts/system/html/js/marketplacesInject.js";
|
||||||
tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_PATH);
|
tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_PATH);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "WalletScriptingInterface.h"
|
#include "WalletScriptingInterface.h"
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
CheckoutProxy::CheckoutProxy(QObject* qmlObject, QObject* parent) : QmlWrapper(qmlObject, parent) {
|
CheckoutProxy::CheckoutProxy(QObject* qmlObject, QObject* parent) : QmlWrapper(qmlObject, parent) {
|
||||||
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
||||||
|
@ -38,4 +39,10 @@ void WalletScriptingInterface::proveAvatarEntityOwnershipVerification(const QUui
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "Failed to prove ownership of:" << entityID << "is not an avatar entity";
|
qCDebug(entities) << "Failed to prove ownership of:" << entityID << "is not an avatar entity";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WalletScriptingInterface::setLimitedCommerce(bool isLimited) {
|
||||||
|
_limitedCommerce = isLimited;
|
||||||
|
Setting::Handle<bool> limitedCommerceSetting{ "limitedCommerce", false };
|
||||||
|
limitedCommerceSetting.set(_limitedCommerce);
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
#include "scripting/HMDScriptingInterface.h"
|
|
||||||
#include <ui/TabletScriptingInterface.h>
|
#include <ui/TabletScriptingInterface.h>
|
||||||
#include <ui/QmlWrapper.h>
|
#include <ui/QmlWrapper.h>
|
||||||
#include <OffscreenUi.h>
|
#include <OffscreenUi.h>
|
||||||
|
@ -68,7 +67,7 @@ public:
|
||||||
void setWalletStatus(const uint& status);
|
void setWalletStatus(const uint& status);
|
||||||
|
|
||||||
bool getLimitedCommerce() { return _limitedCommerce; }
|
bool getLimitedCommerce() { return _limitedCommerce; }
|
||||||
void setLimitedCommerce(bool isLimited) { _limitedCommerce = isLimited; }
|
void setLimitedCommerce(bool isLimited);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -223,12 +223,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
|
|
||||||
bool ContextOverlayInterface::contextOverlayFilterPassed(const EntityItemID& entityItemID) {
|
bool ContextOverlayInterface::contextOverlayFilterPassed(const EntityItemID& entityItemID) {
|
||||||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
||||||
Setting::Handle<bool> _settingSwitch{ "commerce", true };
|
return (entityProperties.getCertificateID().length() != 0);
|
||||||
if (_settingSwitch.get()) {
|
|
||||||
return (entityProperties.getCertificateID().length() != 0);
|
|
||||||
} else {
|
|
||||||
return (entityProperties.getMarketplaceID().length() != 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||||
|
|
|
@ -84,13 +84,10 @@ void RequestFilters::interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info,
|
||||||
static const QString USER_AGENT = "User-Agent";
|
static const QString USER_AGENT = "User-Agent";
|
||||||
const QString tokenStringMobile{ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36" };
|
const QString tokenStringMobile{ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36" };
|
||||||
const QString tokenStringMetaverse{ "Chrome/48.0 (HighFidelityInterface)" };
|
const QString tokenStringMetaverse{ "Chrome/48.0 (HighFidelityInterface)" };
|
||||||
|
const QString tokenStringLimitedCommerce{ "Chrome/48.0 (HighFidelityInterface limitedCommerce)" };
|
||||||
|
Setting::Handle<bool> limitedCommerceSetting{ "limitedCommerce", false };
|
||||||
|
|
||||||
// During the period in which we have HFC commerce in the system, but not applied everywhere:
|
const QString tokenString = !isAuthable ? tokenStringMobile : (limitedCommerceSetting.get() ? tokenStringLimitedCommerce : tokenStringMetaverse);
|
||||||
const QString tokenStringCommerce{ "Chrome/48.0 (HighFidelityInterface WithHFC)" };
|
|
||||||
Setting::Handle<bool> _settingSwitch{ "commerce", true };
|
|
||||||
bool isMoney = _settingSwitch.get();
|
|
||||||
|
|
||||||
const QString tokenString = !isAuthable ? tokenStringMobile : (isMoney ? tokenStringCommerce : tokenStringMetaverse);
|
|
||||||
info.setHttpHeader(USER_AGENT.toLocal8Bit(), tokenString.toLocal8Bit());
|
info.setHttpHeader(USER_AGENT.toLocal8Bit(), tokenString.toLocal8Bit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ var selectedAvatarEntityID = null;
|
||||||
var grabbedAvatarEntityChangeNotifier = null;
|
var grabbedAvatarEntityChangeNotifier = null;
|
||||||
|
|
||||||
var MARKETPLACE_PURCHASES_QML_PATH = "hifi/commerce/wallet/Wallet.qml";
|
var MARKETPLACE_PURCHASES_QML_PATH = "hifi/commerce/wallet/Wallet.qml";
|
||||||
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace" + (WalletScriptingInterface.limitedCommerce ? "?isFree=1" : "");
|
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
|
||||||
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("html/js/marketplacesInject.js");
|
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("html/js/marketplacesInject.js");
|
||||||
|
|
||||||
function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml.
|
function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml.
|
||||||
|
|
|
@ -18,8 +18,7 @@ Script.include("/~/system/libraries/accountUtils.js");
|
||||||
Script.include("/~/system/libraries/connectionUtils.js");
|
Script.include("/~/system/libraries/connectionUtils.js");
|
||||||
var AppUi = Script.require('appUi');
|
var AppUi = Script.require('appUi');
|
||||||
|
|
||||||
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace" +
|
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";;
|
||||||
(WalletScriptingInterface.limitedCommerce ? "?isFree=1" : "");
|
|
||||||
|
|
||||||
// BEGIN AVATAR SELECTOR LOGIC
|
// BEGIN AVATAR SELECTOR LOGIC
|
||||||
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 };
|
||||||
|
|
|
@ -193,7 +193,7 @@ var importingSVOTextOverlay = Overlays.addOverlay("text", {
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace" + (WalletScriptingInterface.limitedCommerce ? "?isFree=1" : "");
|
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
|
||||||
var marketplaceWindow = new OverlayWebWindow({
|
var marketplaceWindow = new OverlayWebWindow({
|
||||||
title: 'Marketplace',
|
title: 'Marketplace',
|
||||||
source: "about:blank",
|
source: "about:blank",
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// Footer.
|
// Footer.
|
||||||
var isInitialHiFiPage = location.href === (marketplaceBaseURL + "/marketplace" + (limitedCommerce ? "?isFree=1" : "?"));
|
var isInitialHiFiPage = location.href === (marketplaceBaseURL + "/marketplace?");
|
||||||
$("body").append(
|
$("body").append(
|
||||||
'<div id="marketplace-navigation">' +
|
'<div id="marketplace-navigation">' +
|
||||||
(!isInitialHiFiPage ? '<input id="back-button" type="button" class="white" value="< Back" />' : '') +
|
(!isInitialHiFiPage ? '<input id="back-button" type="button" class="white" value="< Back" />' : '') +
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
// Footer actions.
|
// Footer actions.
|
||||||
$("#back-button").on("click", function () {
|
$("#back-button").on("click", function () {
|
||||||
(document.referrer !== "") ? window.history.back() : window.location = (marketplaceBaseURL + "/marketplace?") + (limitedCommerce ? "isFree=1" : "");
|
(document.referrer !== "") ? window.history.back() : window.location = (marketplaceBaseURL + "/marketplace?");
|
||||||
});
|
});
|
||||||
$("#all-markets").on("click", function () {
|
$("#all-markets").on("click", function () {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
window.location = "https://clara.io/library?gameCheck=true&public=true";
|
window.location = "https://clara.io/library?gameCheck=true&public=true";
|
||||||
});
|
});
|
||||||
$('#exploreHifiMarketplace').on('click', function () {
|
$('#exploreHifiMarketplace').on('click', function () {
|
||||||
window.location = marketplaceBaseURL + "/marketplace" + (limitedCommerce ? "?isFree=1" : "?");
|
window.location = marketplaceBaseURL + "/marketplace?";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ Script.include("../libraries/WebTablet.js");
|
||||||
|
|
||||||
var toolIconUrl = Script.resolvePath("../assets/images/tools/");
|
var toolIconUrl = Script.resolvePath("../assets/images/tools/");
|
||||||
|
|
||||||
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace" + (WalletScriptingInterface.limitedCommerce ? "?isFree=1" : "");
|
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
|
||||||
var marketplaceWindow = new OverlayWebWindow({
|
var marketplaceWindow = new OverlayWebWindow({
|
||||||
title: "Marketplace",
|
title: "Marketplace",
|
||||||
source: "about:blank",
|
source: "about:blank",
|
||||||
|
|
|
@ -165,9 +165,6 @@ function openMarketplace(optionalItemOrUrl) {
|
||||||
if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) {
|
if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) {
|
||||||
url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl;
|
url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl;
|
||||||
}
|
}
|
||||||
if (WalletScriptingInterface.limitedCommerce) {
|
|
||||||
url += "?isFree=1";
|
|
||||||
}
|
|
||||||
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
|
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +745,7 @@ var onTabletScreenChanged = function onTabletScreenChanged(type, url) {
|
||||||
|
|
||||||
|
|
||||||
var BUTTON_NAME = "MARKET";
|
var BUTTON_NAME = "MARKET";
|
||||||
var MARKETPLACE_URL = METAVERSE_SERVER_URL + "/marketplace" + (WalletScriptingInterface.limitedCommerce ? "?isFree=1" : "");
|
var MARKETPLACE_URL = METAVERSE_SERVER_URL + "/marketplace";
|
||||||
// Append "?" if necessary to signal injected script that it's the initial page.
|
// Append "?" if necessary to signal injected script that it's the initial page.
|
||||||
var MARKETPLACE_URL_INITIAL = MARKETPLACE_URL + (MARKETPLACE_URL.indexOf("?") > -1 ? "" : "?");
|
var MARKETPLACE_URL_INITIAL = MARKETPLACE_URL + (MARKETPLACE_URL.indexOf("?") > -1 ? "" : "?");
|
||||||
var ui;
|
var ui;
|
||||||
|
|
Loading…
Reference in a new issue