Merge branch 'master' of https://github.com/highfidelity/hifi into the-lost-ECDSA

This commit is contained in:
howard-stearns 2017-11-28 16:59:44 -08:00
commit 281b4cfd88
11 changed files with 109 additions and 20 deletions

View file

@ -916,6 +916,14 @@
"default": false "default": false
} }
] ]
},
{
"name": "multi_kick_logged_in",
"type": "checkbox",
"label": "Multi-Kick for Logged In Users",
"help": "Kick logged in users by machine fingerprint (in addition to the default kick by username)",
"default": false,
"advanced": true
} }
] ]
}, },

View file

@ -183,6 +183,11 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
qDebug() << "| user-permissions: specific MAC matches, so:" << userPerms; qDebug() << "| user-permissions: specific MAC matches, so:" << userPerms;
#endif
} else if (_server->_settingsManager.hasPermissionsForMachineFingerprint(machineFingerprint)) {
userPerms = _server->_settingsManager.getPermissionsForMachineFingerprint(machineFingerprint);
#ifdef WANT_DEBUG
qDebug(() << "| user-permissions: specific Machine Fingerprint matches, so: " << userPerms;
#endif #endif
} else if (_server->_settingsManager.hasPermissionsForIP(senderAddress)) { } else if (_server->_settingsManager.hasPermissionsForIP(senderAddress)) {
// this user comes from an IP we have in our permissions table, apply those permissions // this user comes from an IP we have in our permissions table, apply those permissions

View file

@ -672,7 +672,7 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
bool newPermissions = false; bool newPermissions = false;
if (!verifiedUsername.isEmpty()) { if (!verifiedUsername.isEmpty()) {
// if we have a verified user name for this user, we apply the kick to the username // if we have a verified user name for this user, we first apply the kick to the username
// check if there were already permissions // check if there were already permissions
bool hadPermissions = havePermissionsForName(verifiedUsername); bool hadPermissions = havePermissionsForName(verifiedUsername);
@ -684,7 +684,14 @@ 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 { }
// if we didn't have a username, or this domain-server uses the "multi-kick" setting to
// kick logged in users via username AND machine fingerprint (or IP as fallback)
// then we remove connect permissions for the machine fingerprint (or IP as fallback)
const QString MULTI_KICK_SETTINGS_KEYPATH = "security.multi_kick_logged_in";
if (verifiedUsername.isEmpty() || valueOrDefaultValueForKeyPath(MULTI_KICK_SETTINGS_KEYPATH).toBool()) {
// remove connect permissions for the machine fingerprint // remove connect permissions for the machine fingerprint
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData()); DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
if (nodeData) { if (nodeData) {

View file

@ -36,7 +36,9 @@ Rectangle {
readonly property bool hmdHead: headBox.checked readonly property bool hmdHead: headBox.checked
readonly property bool headPuck: headPuckBox.checked readonly property bool headPuck: headPuckBox.checked
readonly property bool handController: handBox.checked readonly property bool handController: handBox.checked
readonly property bool handPuck: handPuckBox.checked readonly property bool handPuck: handPuckBox.checked
readonly property bool hmdDesktop: hmdInDesktop.checked
property int state: buttonState.disabled property int state: buttonState.disabled
property var lastConfiguration: null property var lastConfiguration: null
@ -53,10 +55,6 @@ Rectangle {
} }
MouseArea { MouseArea {
id: mouseArea id: mouseArea
@ -99,6 +97,7 @@ Rectangle {
onClicked: { onClicked: {
if (checked) { if (checked) {
headPuckBox.checked = false; headPuckBox.checked = false;
hmdInDesktop.checked = false;
} else { } else {
checked = true; checked = true;
} }
@ -121,6 +120,7 @@ Rectangle {
onClicked: { onClicked: {
if (checked) { if (checked) {
headBox.checked = false; headBox.checked = false;
hmdInDesktop.checked = false;
} else { } else {
checked = true; checked = true;
} }
@ -133,6 +133,36 @@ Rectangle {
text: "Tracker" text: "Tracker"
color: hifi.colors.lightGrayText color: hifi.colors.lightGrayText
} }
HifiControls.CheckBox {
id: hmdInDesktop
width: 15
height: 15
boxRadius: 7
visible: viveInDesktop.checked
anchors.top: viveInDesktop.bottom
anchors.topMargin: 5
anchors.left: openVrConfiguration.left
anchors.leftMargin: leftMargin + 10
onClicked: {
if (checked) {
headBox.checked = false;
headPuckBox.checked = false;
} else {
checked = true;
}
sendConfigurationSettings();
}
}
RalewayBold {
size: 12
visible: viveInDesktop.checked
text: "None"
color: hifi.colors.lightGrayText
}
} }
Row { Row {
@ -773,6 +803,11 @@ Rectangle {
anchors.leftMargin: leftMargin + 10 anchors.leftMargin: leftMargin + 10
onClicked: { onClicked: {
if (!checked & hmdInDesktop.checked) {
headBox.checked = true;
headPuckBox.checked = false;
hmdInDesktop.checked = false;
}
sendConfigurationSettings(); sendConfigurationSettings();
} }
} }
@ -790,6 +825,7 @@ Rectangle {
} }
} }
NumberAnimation { NumberAnimation {
id: numberAnimation id: numberAnimation
target: openVrConfiguration target: openVrConfiguration
@ -797,6 +833,7 @@ Rectangle {
to: 0 to: 0
} }
function logAction(action, status) { function logAction(action, status) {
console.log("calibrated from ui"); console.log("calibrated from ui");
var data = { var data = {
@ -877,6 +914,7 @@ Rectangle {
var HmdHead = settings["HMDHead"]; var HmdHead = settings["HMDHead"];
var viveController = settings["handController"]; var viveController = settings["handController"];
var desktopMode = settings["desktopMode"]; var desktopMode = settings["desktopMode"];
var hmdDesktopPosition = settings["hmdDesktopTracking"];
armCircumference.value = settings.armCircumference; armCircumference.value = settings.armCircumference;
shoulderWidth.value = settings.shoulderWidth; shoulderWidth.value = settings.shoulderWidth;
@ -898,6 +936,7 @@ Rectangle {
} }
viveInDesktop.checked = desktopMode; viveInDesktop.checked = desktopMode;
hmdInDesktop.checked = hmdDesktopPosition;
initializeButtonState(); initializeButtonState();
updateCalibrationText(); updateCalibrationText();
@ -1058,7 +1097,8 @@ Rectangle {
"handConfiguration": handObject, "handConfiguration": handObject,
"armCircumference": armCircumference.value, "armCircumference": armCircumference.value,
"shoulderWidth": shoulderWidth.value, "shoulderWidth": shoulderWidth.value,
"desktopMode": viveInDesktop.checked "desktopMode": viveInDesktop.checked,
"hmdDesktopTracking": hmdInDesktop.checked
} }
return settingsObject; return settingsObject;

View file

@ -1602,7 +1602,7 @@ void EntityItem::setParentID(const QUuid& value) {
QUuid oldParentID = getParentID(); QUuid oldParentID = getParentID();
if (oldParentID != value) { if (oldParentID != value) {
EntityTreePointer tree = getTree(); EntityTreePointer tree = getTree();
if (!oldParentID.isNull()) { if (tree && !oldParentID.isNull()) {
tree->removeFromChildrenOfAvatars(getThisPointer()); tree->removeFromChildrenOfAvatars(getThisPointer());
} }
SpatiallyNestable::setParentID(value); SpatiallyNestable::setParentID(value);

View file

@ -385,9 +385,9 @@ void NodeList::sendDomainServerCheckIn() {
packetStream << hardwareAddress; packetStream << hardwareAddress;
// now add the machine fingerprint - a null UUID if logged in, real one if not logged in // now add the machine fingerprint
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
packetStream << (accountManager->isLoggedIn() ? QUuid() : FingerprintUtils::getMachineFingerprint()); packetStream << FingerprintUtils::getMachineFingerprint();
} }
// pack our data to send to the domain-server including // pack our data to send to the domain-server including

View file

@ -57,7 +57,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo); return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
case PacketType::DomainConnectRequest: case PacketType::DomainConnectRequest:
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasMachineFingerprint); return static_cast<PacketVersion>(DomainConnectRequestVersion::AlwaysHasMachineFingerprint);
case PacketType::DomainServerAddedNode: case PacketType::DomainServerAddedNode:
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid); return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);

View file

@ -247,7 +247,8 @@ enum class DomainConnectRequestVersion : PacketVersion {
HasHostname, HasHostname,
HasProtocolVersions, HasProtocolVersions,
HasMACAddress, HasMACAddress,
HasMachineFingerprint HasMachineFingerprint,
AlwaysHasMachineFingerprint
}; };
enum class DomainConnectionDeniedVersion : PacketVersion { enum class DomainConnectionDeniedVersion : PacketVersion {

View file

@ -166,6 +166,11 @@ void ViveControllerManager::setConfigurationSettings(const QJsonObject configura
_resetMatCalculated = false; _resetMatCalculated = false;
} }
} }
if (configurationSettings.contains("hmdDesktopTracking")) {
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
}
_inputDevice->configureCalibrationSettings(configurationSettings); _inputDevice->configureCalibrationSettings(configurationSettings);
saveSettings(); saveSettings();
} }
@ -175,6 +180,7 @@ QJsonObject ViveControllerManager::configurationSettings() {
if (isSupported()) { if (isSupported()) {
QJsonObject configurationSettings = _inputDevice->configurationSettings(); QJsonObject configurationSettings = _inputDevice->configurationSettings();
configurationSettings["desktopMode"] = _desktopMode; configurationSettings["desktopMode"] = _desktopMode;
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
return configurationSettings; return configurationSettings;
} }
@ -414,6 +420,8 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
if (!configurationSettings.empty()) { if (!configurationSettings.empty()) {
auto iter = configurationSettings.begin(); auto iter = configurationSettings.begin();
auto end = configurationSettings.end(); auto end = configurationSettings.end();
bool hmdDesktopTracking = true;
bool hmdDesktopMode = false;
while (iter != end) { while (iter != end) {
if (iter.key() == "bodyConfiguration") { if (iter.key() == "bodyConfiguration") {
setConfigFromString(iter.value().toString()); setConfigFromString(iter.value().toString());
@ -441,9 +449,15 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
_armCircumference = (float)iter.value().toDouble() * CM_TO_M; _armCircumference = (float)iter.value().toDouble() * CM_TO_M;
} else if (iter.key() == "shoulderWidth") { } else if (iter.key() == "shoulderWidth") {
_shoulderWidth = (float)iter.value().toDouble() * CM_TO_M; _shoulderWidth = (float)iter.value().toDouble() * CM_TO_M;
} else if (iter.key() == "hmdDesktopTracking") {
hmdDesktopTracking = iter.value().toBool();
} else if (iter.key() == "desktopMode") {
hmdDesktopMode = iter.value().toBool();
} }
iter++; iter++;
} }
_hmdTrackingEnabled = !(hmdDesktopMode && hmdDesktopTracking);
} }
} }
@ -735,11 +749,18 @@ void ViveControllerManager::InputDevice::handleHmd(uint32_t deviceIndex, const c
_system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_HMD && _system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_HMD &&
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid) { _nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid) {
if (_hmdTrackingEnabled){
const mat4& mat = _nextSimPoseData.poses[deviceIndex]; const mat4& mat = _nextSimPoseData.poses[deviceIndex];
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex]; const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex]; const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity); handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity);
} else {
const mat4& mat = mat4();
const vec3 zero = vec3();
handleHeadPoseEvent(inputCalibrationData, mat, zero, zero);
}
} }
} }

View file

@ -113,7 +113,6 @@ private:
void emitCalibrationStatus(); void emitCalibrationStatus();
void calibrateNextFrame(); void calibrateNextFrame();
class FilteredStick { class FilteredStick {
public: public:
glm::vec2 process(float deltaTime, const glm::vec2& stick) { glm::vec2 process(float deltaTime, const glm::vec2& stick) {
@ -195,6 +194,8 @@ private:
bool _overrideHands { false }; bool _overrideHands { false };
mutable std::recursive_mutex _lock; mutable std::recursive_mutex _lock;
bool _hmdTrackingEnabled { true };
QString configToString(Config config); QString configToString(Config config);
friend class ViveControllerManager; friend class ViveControllerManager;
}; };
@ -204,7 +205,10 @@ private:
bool _registeredWithInputMapper { false }; bool _registeredWithInputMapper { false };
bool _modelLoaded { false }; bool _modelLoaded { false };
bool _resetMatCalculated { false }; bool _resetMatCalculated { false };
bool _desktopMode { false }; bool _desktopMode { false };
bool _hmdDesktopTracking { false };
glm::mat4 _resetMat { glm::mat4() }; glm::mat4 _resetMat { glm::mat4() };
model::Geometry _modelGeometry; model::Geometry _modelGeometry;
gpu::TexturePointer _texture; gpu::TexturePointer _texture;

View file

@ -311,7 +311,10 @@
viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 }; viewFinderOverlayDim = { x: glassPaneWidth, y: -glassPaneWidth, z: 0 };
} }
updateOverlay(); updateOverlay();
// if secondary camera is currently being used for mirror projection then don't update it's aspect ratio (will be done in spectatorCameraOn)
if (!spectatorCameraConfig.mirrorProjection) {
spectatorCameraConfig.resetSizeSpectatorCamera(geometryChanged.width, geometryChanged.height); spectatorCameraConfig.resetSizeSpectatorCamera(geometryChanged.width, geometryChanged.height);
}
setDisplay(monitorShowsCameraView); setDisplay(monitorShowsCameraView);
} }