Expose protocol version to qml, and use it in query.

This commit is contained in:
howard-stearns 2016-07-18 18:12:27 -07:00
parent 98555be987
commit 57955a2b56
3 changed files with 21 additions and 4 deletions

View file

@ -51,6 +51,7 @@ Window {
}
property var allDomains: [];
property var suggestionChoices: [];
property var domainsBaseUrl: null;
property int cardWidth: 200;
property int cardHeight: 152;
@ -245,10 +246,20 @@ Window {
if (!options.page) {
options.page = 1;
}
// FIXME: really want places I'm allowed in, not just open ones.
// FIXME: If logged in, add hifi to the restriction options, in order to include places that require login.
// FIXME: add maturity
var url = "https://metaverse.highfidelity.com/api/v1/domains/all?open&active&restriction=open&sort_by=users&sort_order=desc&page=" + options.page + "&users=" + options.minUsers + "-" + options.maxUsers;
if (!domainsBaseUrl) {
var domainsOptions = [
'open', // published hours handle now
'active', // has at least one person connected. FIXME: really want any place that is verified accessible.
// FIXME: really want places I'm allowed in, not just open ones.
'restriction=open', // Not by whitelist, etc. FIXME: If logged in, add hifi to the restriction options, in order to include places that require login.
// FIXME add maturity
'protocol=' + AddressManager.protocolVersion(),
'sort_by=users',
'sort_order=desc',
];
domainsBaseUrl = "https://metaverse.highfidelity.com/api/v1/domains/all?" + domainsOptions.join('&');
}
var url = domainsBaseUrl + "&page=" + options.page + "&users=" + options.minUsers + "-" + options.maxUsers;
getRequest(url, function (error, json) {
if (!error && (json.status !== 'success')) {
error = new Error("Bad response: " + JSON.stringify(json));

View file

@ -24,6 +24,7 @@
#include "NodeList.h"
#include "NetworkLogging.h"
#include "UserActivityLogger.h"
#include "udt/PacketHeaders.h"
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
@ -37,6 +38,10 @@ AddressManager::AddressManager() :
}
QString AddressManager::protocolVersion() {
return protocolVersionsSignatureBase64();
}
bool AddressManager::isConnected() {
return DependencyManager::get<NodeList>()->getDomainHandler().isConnected();
}

View file

@ -39,6 +39,7 @@ class AddressManager : public QObject, public Dependency {
Q_PROPERTY(QString hostname READ getHost)
Q_PROPERTY(QString pathname READ currentPath)
public:
Q_INVOKABLE QString protocolVersion();
using PositionGetter = std::function<glm::vec3()>;
using OrientationGetter = std::function<glm::quat()>;