mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 22:33:04 +02:00
Merge pull request #9096 from howard-stearns/location-cleanup
location cleanup to make people more aware of their sandbox placename
This commit is contained in:
commit
811fc0afbe
4 changed files with 41 additions and 5 deletions
|
@ -410,7 +410,7 @@ Window {
|
|||
if (place.action === 'snapshot') {
|
||||
return true;
|
||||
}
|
||||
return (place.place_name !== AddressManager.hostname); // Not our entry, but do show other entry points to current domain.
|
||||
return (place.place_name !== AddressManager.placename); // Not our entry, but do show other entry points to current domain.
|
||||
}
|
||||
property var selectedTab: allTab;
|
||||
function tabSelect(textButton) {
|
||||
|
@ -437,7 +437,10 @@ Window {
|
|||
property int requestId: 0;
|
||||
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
|
||||
var options = [
|
||||
'now=' + new Date().toISOString(),
|
||||
'include_actions=' + selectedTab.includeActions,
|
||||
'restriction=' + (Account.isLoggedIn() ? 'open,hifi' : 'open'),
|
||||
'require_online=true',
|
||||
'protocol=' + encodeURIComponent(AddressManager.protocolVersion()),
|
||||
'page=' + pageNumber
|
||||
];
|
||||
|
@ -498,7 +501,7 @@ Window {
|
|||
notice.text = AddressManager.isConnected ? "Your location:" : "Not Connected";
|
||||
notice.color = AddressManager.isConnected ? hifiStyleConstants.colors.baseGrayHighlight : hifiStyleConstants.colors.redHighlight;
|
||||
// Display hostname, which includes ip address, localhost, and other non-placenames.
|
||||
location.text = (AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : '');
|
||||
location.text = (AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "AddressManager.h"
|
||||
#include "NodeList.h"
|
||||
#include "NetworkingConstants.h"
|
||||
#include "NetworkLogging.h"
|
||||
#include "UserActivityLogger.h"
|
||||
#include "udt/PacketHeaders.h"
|
||||
|
@ -750,6 +751,14 @@ void AddressManager::copyPath() {
|
|||
QApplication::clipboard()->setText(currentPath());
|
||||
}
|
||||
|
||||
QString AddressManager::getDomainId() const {
|
||||
return DependencyManager::get<NodeList>()->getDomainHandler().getUUID().toString();
|
||||
}
|
||||
|
||||
const QUrl AddressManager::getMetaverseServerUrl() const {
|
||||
return NetworkingConstants::METAVERSE_SERVER_URL;
|
||||
}
|
||||
|
||||
void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) {
|
||||
// make sure that this response is for the domain we're currently connected to
|
||||
auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
|
||||
|
|
|
@ -35,11 +35,13 @@ class AddressManager : public QObject, public Dependency {
|
|||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
Q_PROPERTY(bool isConnected READ isConnected)
|
||||
Q_PROPERTY(QUrl href READ currentAddress)
|
||||
Q_PROPERTY(QUrl href READ currentShareableAddress)
|
||||
Q_PROPERTY(QString protocol READ getProtocol)
|
||||
Q_PROPERTY(QString hostname READ getHost)
|
||||
Q_PROPERTY(QString pathname READ currentPath)
|
||||
Q_PROPERTY(QString placename READ getPlaceName)
|
||||
Q_PROPERTY(QString domainId READ getDomainId)
|
||||
Q_PROPERTY(QUrl metaverseServerUrl READ getMetaverseServerUrl)
|
||||
public:
|
||||
Q_INVOKABLE QString protocolVersion();
|
||||
using PositionGetter = std::function<glm::vec3()>;
|
||||
|
@ -67,7 +69,9 @@ public:
|
|||
QString currentFacingPath() const;
|
||||
|
||||
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
|
||||
const QString& getPlaceName() const { return _placeName; }
|
||||
const QString& getPlaceName() const { return _shareablePlaceName.isEmpty() ? _placeName : _shareablePlaceName; }
|
||||
QString getDomainId() const;
|
||||
const QUrl getMetaverseServerUrl() const;
|
||||
|
||||
const QString& getHost() const { return _host; }
|
||||
|
||||
|
|
|
@ -124,6 +124,26 @@ function onClicked() {
|
|||
}, 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 = location.metaverseServerUrl + "/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(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
||||
// show overlays if they were on
|
||||
if (resetOverlays) {
|
||||
|
@ -144,7 +164,7 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
|||
{ localPath: pathAnimatedSnapshot },
|
||||
{ localPath: pathStillSnapshot },
|
||||
{
|
||||
canShare: !!location.placename,
|
||||
canShare: !!isDomainOpen(location.domainId),
|
||||
openFeedAfterShare: shouldOpenFeedAfterShare()
|
||||
}
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue