mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 09:43:51 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into tablet-ui-edit-js
This commit is contained in:
commit
0d10667bb4
5 changed files with 72 additions and 81 deletions
|
@ -61,7 +61,7 @@ void AudioMixerClientData::processPackets() {
|
||||||
_packetQueue.node.clear();
|
_packetQueue.node.clear();
|
||||||
|
|
||||||
while (!_packetQueue.empty()) {
|
while (!_packetQueue.empty()) {
|
||||||
auto& packet = _packetQueue.back();
|
auto& packet = _packetQueue.front();
|
||||||
|
|
||||||
switch (packet->getType()) {
|
switch (packet->getType()) {
|
||||||
case PacketType::MicrophoneAudioNoEcho:
|
case PacketType::MicrophoneAudioNoEcho:
|
||||||
|
|
|
@ -410,7 +410,7 @@ void AvatarMixer::broadcastAvatarData() {
|
||||||
bool isInView = nodeData->otherAvatarInView(otherNodeBox);
|
bool isInView = nodeData->otherAvatarInView(otherNodeBox);
|
||||||
|
|
||||||
// this throttles the extra data to only be sent every Nth message
|
// this throttles the extra data to only be sent every Nth message
|
||||||
if (!isInView && getsOutOfView && (lastSeqToReceiver % EXTRA_AVATAR_DATA_FRAME_RATIO > 0)) {
|
if (!isInView && !getsOutOfView && (lastSeqToReceiver % EXTRA_AVATAR_DATA_FRAME_RATIO > 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +572,7 @@ void AvatarMixer::handleRequestsDomainListDataPacket(QSharedPointer<ReceivedMess
|
||||||
bool isRequesting;
|
bool isRequesting;
|
||||||
message->readPrimitive(&isRequesting);
|
message->readPrimitive(&isRequesting);
|
||||||
nodeData->setRequestsDomainListData(isRequesting);
|
nodeData->setRequestsDomainListData(isRequesting);
|
||||||
|
qDebug() << "node" << nodeData->getNodeID() << "requestsDomainListData" << isRequesting;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include <AvatarData.h> //for KillAvatarReason
|
#include <AvatarData.h> //for KillAvatarReason
|
||||||
|
#include <FingerprintUtils.h>
|
||||||
#include "DomainServerNodeData.h"
|
#include "DomainServerNodeData.h"
|
||||||
|
|
||||||
const QString SETTINGS_DESCRIPTION_RELATIVE_PATH = "/resources/describe-settings.json";
|
const QString SETTINGS_DESCRIPTION_RELATIVE_PATH = "/resources/describe-settings.json";
|
||||||
|
@ -439,7 +440,7 @@ bool DomainServerSettingsManager::unpackPermissionsForKeypath(const QString& key
|
||||||
foreach (QVariant permsHash, permissionsList) {
|
foreach (QVariant permsHash, permissionsList) {
|
||||||
NodePermissionsPointer perms { new NodePermissions(permsHash.toMap()) };
|
NodePermissionsPointer perms { new NodePermissions(permsHash.toMap()) };
|
||||||
QString id = perms->getID();
|
QString id = perms->getID();
|
||||||
|
|
||||||
NodePermissionsKey idKey = perms->getKey();
|
NodePermissionsKey idKey = perms->getKey();
|
||||||
|
|
||||||
if (mapPointer->contains(idKey)) {
|
if (mapPointer->contains(idKey)) {
|
||||||
|
@ -484,7 +485,7 @@ void DomainServerSettingsManager::unpackPermissions() {
|
||||||
// make sure that this permission row is for a non-empty hardware
|
// make sure that this permission row is for a non-empty hardware
|
||||||
if (perms->getKey().first.isEmpty()) {
|
if (perms->getKey().first.isEmpty()) {
|
||||||
_macPermissions.remove(perms->getKey());
|
_macPermissions.remove(perms->getKey());
|
||||||
|
|
||||||
// we removed a row from the MAC permissions, we'll need a re-pack
|
// we removed a row from the MAC permissions, we'll need a re-pack
|
||||||
needPack = true;
|
needPack = true;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +556,7 @@ void DomainServerSettingsManager::unpackPermissions() {
|
||||||
QList<QHash<NodePermissionsKey, NodePermissionsPointer>> permissionsSets;
|
QList<QHash<NodePermissionsKey, NodePermissionsPointer>> permissionsSets;
|
||||||
permissionsSets << _standardAgentPermissions.get() << _agentPermissions.get()
|
permissionsSets << _standardAgentPermissions.get() << _agentPermissions.get()
|
||||||
<< _groupPermissions.get() << _groupForbiddens.get()
|
<< _groupPermissions.get() << _groupForbiddens.get()
|
||||||
<< _ipPermissions.get() << _macPermissions.get()
|
<< _ipPermissions.get() << _macPermissions.get()
|
||||||
<< _machineFingerprintPermissions.get();
|
<< _machineFingerprintPermissions.get();
|
||||||
|
|
||||||
foreach (auto permissionSet, permissionsSets) {
|
foreach (auto permissionSet, permissionsSets) {
|
||||||
|
@ -668,71 +669,68 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
|
||||||
// ensure that the connect permission is clear
|
// ensure that the connect permission is clear
|
||||||
userPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
userPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
||||||
} else {
|
} else {
|
||||||
// otherwise we apply the kick to the IP from active socket for this node and the MAC address
|
// remove connect permissions for the machine fingerprint
|
||||||
|
|
||||||
// remove connect permissions for the IP (falling back to the public socket if not yet active)
|
|
||||||
auto& kickAddress = matchingNode->getActiveSocket()
|
|
||||||
? matchingNode->getActiveSocket()->getAddress()
|
|
||||||
: matchingNode->getPublicSocket().getAddress();
|
|
||||||
|
|
||||||
// probably isLoopback covers it, as whenever I try to ban an agent on same machine as the domain-server
|
|
||||||
// it is always 127.0.0.1, but looking at the public and local addresses just to be sure
|
|
||||||
// TODO: soon we will have feedback (in the form of a message to the client) after we kick. When we
|
|
||||||
// do, we will have a success flag, and perhaps a reason for failure. For now, just don't do it.
|
|
||||||
if (kickAddress == limitedNodeList->getPublicSockAddr().getAddress() ||
|
|
||||||
kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
|
|
||||||
kickAddress.isLoopback() ) {
|
|
||||||
qWarning() << "attempt to kick node running on same machine as domain server, ignoring KickRequest";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NodePermissionsKey ipAddressKey(kickAddress.toString(), QUuid());
|
|
||||||
|
|
||||||
// check if there were already permissions for the IP
|
|
||||||
bool hadIPPermissions = hasPermissionsForIP(kickAddress);
|
|
||||||
|
|
||||||
// grab or create permissions for the given IP address
|
|
||||||
auto ipPermissions = _ipPermissions[ipAddressKey];
|
|
||||||
|
|
||||||
if (!hadIPPermissions || ipPermissions->can(NodePermissions::Permission::canConnectToDomain)) {
|
|
||||||
newPermissions = true;
|
|
||||||
|
|
||||||
ipPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
|
||||||
}
|
|
||||||
|
|
||||||
// potentially remove connect permissions for the MAC address and machine fingerprint
|
|
||||||
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
// mac address first
|
// get this machine's fingerprint
|
||||||
NodePermissionsKey macAddressKey(nodeData->getHardwareAddress(), 0);
|
auto domainServerFingerprint = FingerprintUtils::getMachineFingerprint();
|
||||||
|
|
||||||
bool hadMACPermissions = hasPermissionsForMAC(nodeData->getHardwareAddress());
|
if (nodeData->getMachineFingerprint() == domainServerFingerprint) {
|
||||||
|
qWarning() << "attempt to kick node running on same machine as domain server (by fingerprint), ignoring KickRequest";
|
||||||
auto macPermissions = _macPermissions[macAddressKey];
|
return;
|
||||||
|
|
||||||
if (!hadMACPermissions || macPermissions->can(NodePermissions::Permission::canConnectToDomain)) {
|
|
||||||
newPermissions = true;
|
|
||||||
|
|
||||||
macPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now for machine fingerprint
|
|
||||||
NodePermissionsKey machineFingerprintKey(nodeData->getMachineFingerprint().toString(), 0);
|
NodePermissionsKey machineFingerprintKey(nodeData->getMachineFingerprint().toString(), 0);
|
||||||
|
|
||||||
|
// check if there were already permissions for the fingerprint
|
||||||
bool hadFingerprintPermissions = hasPermissionsForMachineFingerprint(nodeData->getMachineFingerprint());
|
bool hadFingerprintPermissions = hasPermissionsForMachineFingerprint(nodeData->getMachineFingerprint());
|
||||||
|
|
||||||
|
// grab or create permissions for the given fingerprint
|
||||||
auto fingerprintPermissions = _machineFingerprintPermissions[machineFingerprintKey];
|
auto fingerprintPermissions = _machineFingerprintPermissions[machineFingerprintKey];
|
||||||
|
|
||||||
|
// write them
|
||||||
if (!hadFingerprintPermissions || fingerprintPermissions->can(NodePermissions::Permission::canConnectToDomain)) {
|
if (!hadFingerprintPermissions || fingerprintPermissions->can(NodePermissions::Permission::canConnectToDomain)) {
|
||||||
newPermissions = true;
|
newPermissions = true;
|
||||||
fingerprintPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
fingerprintPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// if no node data, all we can do is IP address
|
||||||
|
auto& kickAddress = matchingNode->getActiveSocket()
|
||||||
|
? matchingNode->getActiveSocket()->getAddress()
|
||||||
|
: matchingNode->getPublicSocket().getAddress();
|
||||||
|
|
||||||
|
// probably isLoopback covers it, as whenever I try to ban an agent on same machine as the domain-server
|
||||||
|
// it is always 127.0.0.1, but looking at the public and local addresses just to be sure
|
||||||
|
// TODO: soon we will have feedback (in the form of a message to the client) after we kick. When we
|
||||||
|
// do, we will have a success flag, and perhaps a reason for failure. For now, just don't do it.
|
||||||
|
if (kickAddress == limitedNodeList->getPublicSockAddr().getAddress() ||
|
||||||
|
kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
|
||||||
|
kickAddress.isLoopback() ) {
|
||||||
|
qWarning() << "attempt to kick node running on same machine as domain server, ignoring KickRequest";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NodePermissionsKey ipAddressKey(kickAddress.toString(), QUuid());
|
||||||
|
|
||||||
|
// check if there were already permissions for the IP
|
||||||
|
bool hadIPPermissions = hasPermissionsForIP(kickAddress);
|
||||||
|
|
||||||
|
// grab or create permissions for the given IP address
|
||||||
|
auto ipPermissions = _ipPermissions[ipAddressKey];
|
||||||
|
|
||||||
|
if (!hadIPPermissions || ipPermissions->can(NodePermissions::Permission::canConnectToDomain)) {
|
||||||
|
newPermissions = true;
|
||||||
|
|
||||||
|
ipPermissions->clear(NodePermissions::Permission::canConnectToDomain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we are here, then we kicked them, so send the KillAvatar message to everyone
|
|
||||||
|
// if we are here, then we kicked them, so send the KillAvatar message
|
||||||
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason), true);
|
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason), true);
|
||||||
packet->write(nodeUUID.toRfc4122());
|
packet->write(nodeUUID.toRfc4122());
|
||||||
packet->writePrimitive(KillAvatarReason::NoReason);
|
packet->writePrimitive(KillAvatarReason::NoReason);
|
||||||
|
|
||||||
// send to avatar mixer, it sends the kill to everyone else
|
// send to avatar mixer, it sends the kill to everyone else
|
||||||
limitedNodeList->broadcastToNodes(std::move(packet), NodeSet() << NodeType::AvatarMixer);
|
limitedNodeList->broadcastToNodes(std::move(packet), NodeSet() << NodeType::AvatarMixer);
|
||||||
|
|
||||||
|
@ -743,7 +741,7 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
|
||||||
// we've changed permissions, time to store them to disk and emit our signal to say they have changed
|
// we've changed permissions, time to store them to disk and emit our signal to say they have changed
|
||||||
packPermissions();
|
packPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we emit this no matter what -- though if this isn't a new permission probably 2 people are racing to kick and this
|
// we emit this no matter what -- though if this isn't a new permission probably 2 people are racing to kick and this
|
||||||
// person lost the race. No matter, just be sure this is called as otherwise it takes like 10s for the person being banned
|
// person lost the race. No matter, just be sure this is called as otherwise it takes like 10s for the person being banned
|
||||||
// to go away
|
// to go away
|
||||||
|
|
|
@ -360,7 +360,7 @@ Rectangle {
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: displayNameHeaderMetrics
|
id: displayNameHeaderMetrics
|
||||||
text: displayNameHeader.title
|
text: displayNameHeader.title
|
||||||
font: displayNameHeader.font
|
// font: displayNameHeader.font // was this always undefined? giving error now...
|
||||||
}
|
}
|
||||||
// This Rectangle refers to the [?] popup button next to "NAMES"
|
// This Rectangle refers to the [?] popup button next to "NAMES"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -426,7 +426,6 @@ Rectangle {
|
||||||
onExited: adminHelpText.color = hifi.colors.redHighlight
|
onExited: adminHelpText.color = hifi.colors.redHighlight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HifiControls.Keyboard {
|
HifiControls.Keyboard {
|
||||||
id: keyboard
|
id: keyboard
|
||||||
|
@ -438,6 +437,7 @@ Rectangle {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Timer used when selecting table rows that aren't yet present in the model
|
// Timer used when selecting table rows that aren't yet present in the model
|
||||||
// (i.e. when selecting avatars using edit.js or sphere overlays)
|
// (i.e. when selecting avatars using edit.js or sphere overlays)
|
||||||
|
|
|
@ -290,17 +290,14 @@ function populateUserList(selectData) {
|
||||||
userName: '',
|
userName: '',
|
||||||
sessionId: id || '',
|
sessionId: id || '',
|
||||||
audioLevel: 0.0,
|
audioLevel: 0.0,
|
||||||
admin: false
|
admin: false,
|
||||||
|
personalMute: !!id && Users.getPersonalMuteStatus(id), // expects proper boolean, not null
|
||||||
|
ignore: !!id && Users.getIgnoreStatus(id) // ditto
|
||||||
};
|
};
|
||||||
// Request the username, fingerprint, and admin status from the given UUID
|
|
||||||
// Username and fingerprint returns default constructor output if the requesting user isn't an admin
|
|
||||||
Users.requestUsernameFromID(id);
|
|
||||||
// Request personal mute status and ignore status
|
|
||||||
// from NodeList (as long as we're not requesting it for our own ID)
|
|
||||||
if (id) {
|
if (id) {
|
||||||
avatarPalDatum['personalMute'] = Users.getPersonalMuteStatus(id);
|
|
||||||
avatarPalDatum['ignore'] = Users.getIgnoreStatus(id);
|
|
||||||
addAvatarNode(id); // No overlay for ourselves
|
addAvatarNode(id); // No overlay for ourselves
|
||||||
|
// Everyone needs to see admin status. Username and fingerprint returns default constructor output if the requesting user isn't an admin.
|
||||||
|
Users.requestUsernameFromID(id);
|
||||||
}
|
}
|
||||||
data.push(avatarPalDatum);
|
data.push(avatarPalDatum);
|
||||||
print('PAL data:', JSON.stringify(avatarPalDatum));
|
print('PAL data:', JSON.stringify(avatarPalDatum));
|
||||||
|
@ -314,20 +311,13 @@ function populateUserList(selectData) {
|
||||||
|
|
||||||
// The function that handles the reply from the server
|
// The function that handles the reply from the server
|
||||||
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
||||||
var data;
|
var data = [
|
||||||
// If the ID we've received is our ID...
|
(MyAvatar.sessionUUID === id) ? '' : id, // Pal.qml recognizes empty id specially.
|
||||||
if (MyAvatar.sessionUUID === id) {
|
// If we get username (e.g., if in future we receive it when we're friends), use it.
|
||||||
// Set the data to contain specific strings.
|
// Otherwise, use valid machineFingerprint (which is not valid when not an admin).
|
||||||
data = ['', username, isAdmin];
|
username || (Users.canKick && machineFingerprint) || '',
|
||||||
} else if (Users.canKick) {
|
isAdmin
|
||||||
// Set the data to contain the ID and the username (if we have one)
|
];
|
||||||
// or fingerprint (if we don't have a username) string.
|
|
||||||
data = [id, username || machineFingerprint, isAdmin];
|
|
||||||
} else {
|
|
||||||
// Set the data to contain specific strings.
|
|
||||||
data = [id, '', isAdmin];
|
|
||||||
}
|
|
||||||
print('Username Data:', JSON.stringify(data));
|
|
||||||
// Ship the data off to QML
|
// Ship the data off to QML
|
||||||
sendToQml({ method: 'updateUsername', params: data });
|
sendToQml({ method: 'updateUsername', params: data });
|
||||||
}
|
}
|
||||||
|
@ -339,13 +329,15 @@ function updateOverlays() {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return; // don't update ourself
|
return; // don't update ourself
|
||||||
}
|
}
|
||||||
|
var avatar = AvatarList.getAvatar(id);
|
||||||
|
if (!avatar) {
|
||||||
|
return; // will be deleted below if there had been an overlay.
|
||||||
|
}
|
||||||
var overlay = ExtendedOverlay.get(id);
|
var overlay = ExtendedOverlay.get(id);
|
||||||
if (!overlay) { // For now, we're treating this as a temporary loss, as from the personal space bubble. Add it back.
|
if (!overlay) { // For now, we're treating this as a temporary loss, as from the personal space bubble. Add it back.
|
||||||
print('Adding non-PAL avatar node', id);
|
print('Adding non-PAL avatar node', id);
|
||||||
overlay = addAvatarNode(id);
|
overlay = addAvatarNode(id);
|
||||||
}
|
}
|
||||||
var avatar = AvatarList.getAvatar(id);
|
|
||||||
var target = avatar.position;
|
var target = avatar.position;
|
||||||
var distance = Vec3.distance(target, eye);
|
var distance = Vec3.distance(target, eye);
|
||||||
var offset = 0.2;
|
var offset = 0.2;
|
||||||
|
|
Loading…
Reference in a new issue