mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
server protocols
This commit is contained in:
parent
9f2b6dc40b
commit
f1806eb649
4 changed files with 30 additions and 1 deletions
|
@ -375,7 +375,10 @@ Window {
|
||||||
}
|
}
|
||||||
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
|
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
|
||||||
var options = [
|
var options = [
|
||||||
|
'now=' + new Date().toISOString(),
|
||||||
'include_actions=snapshot,concurrency',
|
'include_actions=snapshot,concurrency',
|
||||||
|
'restriction=' + (Account.isLoggedIn() ? 'open,hifi' : 'open'),
|
||||||
|
'require_online=true',
|
||||||
'protocol=' + encodeURIComponent(AddressManager.protocolVersion()),
|
'protocol=' + encodeURIComponent(AddressManager.protocolVersion()),
|
||||||
'page=' + pageNumber
|
'page=' + pageNumber
|
||||||
];
|
];
|
||||||
|
|
|
@ -750,6 +750,10 @@ void AddressManager::copyPath() {
|
||||||
QApplication::clipboard()->setText(currentPath());
|
QApplication::clipboard()->setText(currentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AddressManager::getDomainId() const {
|
||||||
|
return DependencyManager::get<NodeList>()->getDomainHandler().getUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) {
|
void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) {
|
||||||
// make sure that this response is for the domain we're currently connected to
|
// make sure that this response is for the domain we're currently connected to
|
||||||
auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
|
auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
|
||||||
|
|
|
@ -40,6 +40,7 @@ class AddressManager : public QObject, public Dependency {
|
||||||
Q_PROPERTY(QString hostname READ getHost)
|
Q_PROPERTY(QString hostname READ getHost)
|
||||||
Q_PROPERTY(QString pathname READ currentPath)
|
Q_PROPERTY(QString pathname READ currentPath)
|
||||||
Q_PROPERTY(QString placename READ getPlaceName)
|
Q_PROPERTY(QString placename READ getPlaceName)
|
||||||
|
Q_PROPERTY(QString domainId READ getDomainId)
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE QString protocolVersion();
|
Q_INVOKABLE QString protocolVersion();
|
||||||
using PositionGetter = std::function<glm::vec3()>;
|
using PositionGetter = std::function<glm::vec3()>;
|
||||||
|
@ -68,6 +69,7 @@ public:
|
||||||
|
|
||||||
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
|
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
|
||||||
const QString& getPlaceName() const { return _shareablePlaceName.isEmpty() ? _placeName : _shareablePlaceName; }
|
const QString& getPlaceName() const { return _shareablePlaceName.isEmpty() ? _placeName : _shareablePlaceName; }
|
||||||
|
QString getDomainId() const;
|
||||||
|
|
||||||
const QString& getHost() const { return _host; }
|
const QString& getHost() const { return _host; }
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,26 @@ function onClicked() {
|
||||||
}, SNAPSHOT_DELAY);
|
}, SNAPSHOT_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDomainOpen(id) {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
var options = [
|
||||||
|
'now=' + new Date().toISOString(),
|
||||||
|
'include_actions=concurrency',
|
||||||
|
'domain_id=' + id.slice(1, -1),
|
||||||
|
'restriction=open,hifi' // If we're sharing, we're logged in
|
||||||
|
// If we're here, protocol matches, and it is online
|
||||||
|
];
|
||||||
|
var url = "https://metaverse.highfidelity.com/api/v1/user_stories?" + options.join('&');
|
||||||
|
request.open("GET", url, false);
|
||||||
|
request.send();
|
||||||
|
if (request.status != 200) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var response = JSON.parse(request.response); // Not parsed for us.
|
||||||
|
return (response.status === 'success') &&
|
||||||
|
response.total_entries;
|
||||||
|
}
|
||||||
|
|
||||||
function resetButtons(path, notify) {
|
function resetButtons(path, notify) {
|
||||||
// show overlays if they were on
|
// show overlays if they were on
|
||||||
if (resetOverlays) {
|
if (resetOverlays) {
|
||||||
|
@ -143,7 +163,7 @@ function resetButtons(path, notify) {
|
||||||
confirmShare([
|
confirmShare([
|
||||||
{ localPath: path },
|
{ localPath: path },
|
||||||
{
|
{
|
||||||
canShare: !!location.placename,
|
canShare: !!isDomainOpen(location.domainId),
|
||||||
openFeedAfterShare: shouldOpenFeedAfterShare()
|
openFeedAfterShare: shouldOpenFeedAfterShare()
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue