Skip to content

Commit

Permalink
Merge remote-tracking branch 'overte/master' into application
Browse files Browse the repository at this point in the history
  • Loading branch information
HifiExperiments committed Oct 25, 2024
2 parents 2345bcc + a220872 commit c6731d2
Show file tree
Hide file tree
Showing 71 changed files with 347 additions and 3,860 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = {
"EventBridge": false,
"FaceTracker": false,
"GlobalServices": false,
"GooglePoly": false,
"Graphics": false,
"HifiAbout": false,
"HMD": false,
Expand Down
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,6 @@ else()
set(MOBILE 0)
endif()

set(SCREENSHARE 0)
if (APPLE AND NOT CLIENT_ONLY)
# Don't include Screenshare in OSX client-only builds.
set(SCREENSHARE 1)
endif()

# Use default time server if none defined in environment
set_from_env(TIMESERVER_URL TIMESERVER_URL "http://timestamp.comodoca.com?td=sha256")

Expand Down Expand Up @@ -462,10 +456,6 @@ if (BUILD_GPU_FRAME_PLAYER_ONLY)
add_subdirectory(tools/gpu-frame-player)
else()

if (SCREENSHARE)
add_subdirectory(screenshare)
endif()

# BUILD_TOOLS option will be handled inside the tools's CMakeLists.txt because 'scribe' tool is required for build anyway
add_subdirectory(tools)

Expand Down
22 changes: 0 additions & 22 deletions assignment-client/src/avatars/AvatarMixerClientData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ using std::static_pointer_cast;
struct FindContainingZone {
glm::vec3 position;
bool isInPriorityZone { false };
bool isInScreenshareZone { false };
float priorityZoneVolume { std::numeric_limits<float>::max() };
float screenshareZoneVolume { priorityZoneVolume };
EntityItemID screenshareZoneid{};

static bool operation(const OctreeElementPointer& element, void* extraData) {
auto findContainingZone = static_cast<FindContainingZone*>(extraData);
Expand All @@ -103,19 +100,12 @@ struct FindContainingZone {
if (item->getType() == EntityTypes::Zone && item->contains(findContainingZone->position)) {
auto zoneItem = static_pointer_cast<ZoneEntityItem>(item);
auto avatarPriorityProperty = zoneItem->getAvatarPriority();
auto screenshareProperty = zoneItem->getScreenshare();
float volume = zoneItem->getVolumeEstimate();
if (avatarPriorityProperty != COMPONENT_MODE_INHERIT
&& volume < findContainingZone->priorityZoneVolume) { // Smaller volume wins
findContainingZone->isInPriorityZone = avatarPriorityProperty == COMPONENT_MODE_ENABLED;
findContainingZone->priorityZoneVolume = volume;
}
if (screenshareProperty != COMPONENT_MODE_INHERIT
&& volume < findContainingZone->screenshareZoneVolume) {
findContainingZone->isInScreenshareZone = screenshareProperty == COMPONENT_MODE_ENABLED;
findContainingZone->screenshareZoneVolume = volume;
findContainingZone->screenshareZoneid = zoneItem->getEntityItemID();
}
}
});
return true; // Keep recursing
Expand Down Expand Up @@ -157,18 +147,6 @@ int AvatarMixerClientData::parseData(ReceivedMessage& message, const WorkerShare
if (currentlyHasPriority != _avatar->getHasPriority()) {
_avatar->setHasPriority(currentlyHasPriority);
}
bool isInScreenshareZone = findContainingZone.isInScreenshareZone;
if (isInScreenshareZone != _avatar->isInScreenshareZone()
|| findContainingZone.screenshareZoneid != _avatar->getScreenshareZone()) {
_avatar->setInScreenshareZone(isInScreenshareZone);
_avatar->setScreenshareZone(findContainingZone.screenshareZoneid);
const QUuid& zoneId = isInScreenshareZone ? findContainingZone.screenshareZoneid : QUuid();
auto nodeList = DependencyManager::get<NodeList>();
auto packet = NLPacket::create(PacketType::AvatarZonePresence, 2 * NUM_BYTES_RFC4122_UUID, true);
packet->write(_avatar->getSessionUUID().toRfc4122());
packet->write(zoneId.toRfc4122());
nodeList->sendPacket(std::move(packet), nodeList->getDomainSockAddr());
}
_avatar->setNeedsHeroCheck(false);
}

Expand Down
8 changes: 1 addition & 7 deletions assignment-client/src/avatars/MixerAvatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@ class MixerAvatar : public AvatarData {
bool needsIdentityUpdate() const { return _needsIdentityUpdate; }
void setNeedsIdentityUpdate(bool value = true) { _needsIdentityUpdate = value; }

bool isInScreenshareZone() const { return _inScreenshareZone; }
void setInScreenshareZone(bool value = true) { _inScreenshareZone = value; }
const QUuid& getScreenshareZone() const { return _screenshareZone; }
void setScreenshareZone(QUuid zone) { _screenshareZone = zone; }

private:
bool _needsHeroCheck { false };
bool _needsIdentityUpdate { false };
bool _inScreenshareZone { false };
QUuid _screenshareZone;

};

using MixerAvatarSharedPointer = std::shared_ptr<MixerAvatar>;
Expand Down
9 changes: 0 additions & 9 deletions cmake/macros/SetPackagingParameters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ macro(SET_PACKAGING_PARAMETERS)

set(CONSOLE_INSTALL_DIR ".")
set(INTERFACE_INSTALL_DIR ".")
set(SCREENSHARE_INSTALL_DIR ".")
set(NITPICK_INSTALL_DIR ".")

if (CLIENT_ONLY)
Expand All @@ -143,27 +142,20 @@ macro(SET_PACKAGING_PARAMETERS)
endif()
set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}")

set(SCREENSHARE_EXEC_NAME "hifi-screenshare.app")
set(SCREENSHARE_INSTALL_APP_PATH "${SCREENSHARE_INSTALL_DIR}/${SCREENSHARE_EXEC_NAME}")

set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents")
set(COMPONENT_APP_PATH "${CONSOLE_APP_CONTENTS}/MacOS/Components.app")
set(COMPONENT_INSTALL_DIR "${COMPONENT_APP_PATH}/Contents/MacOS")
set(CONSOLE_PLUGIN_INSTALL_DIR "${COMPONENT_APP_PATH}/Contents/PlugIns")

set(SCREENSHARE_APP_CONTENTS "${SCREENSHARE_INSTALL_APP_PATH}/Contents")

set(INTERFACE_INSTALL_APP_PATH "${INTERFACE_INSTALL_DIR}/${INTERFACE_BUNDLE_NAME}.app")
set(INTERFACE_ICON_FILENAME "${INTERFACE_ICON_PREFIX}.icns")
set(NITPICK_ICON_FILENAME "${NITPICK_ICON_PREFIX}.icns")
else ()
if (WIN32)
set(CONSOLE_INSTALL_DIR "server-console")
set(SCREENSHARE_INSTALL_DIR "hifi-screenshare")
set(NITPICK_INSTALL_DIR "nitpick")
else ()
set(CONSOLE_INSTALL_DIR ".")
set(SCREENSHARE_INSTALL_DIR ".")
set(NITPICK_INSTALL_DIR ".")
endif ()

Expand All @@ -177,7 +169,6 @@ macro(SET_PACKAGING_PARAMETERS)
set(NITPICK_ICON_FILENAME "${NITPICK_ICON_PREFIX}.ico")

set(CONSOLE_EXEC_NAME "server-console.exe")
set(SCREENSHARE_EXEC_NAME "hifi-screenshare.exe")

set(DS_EXEC_NAME "domain-server.exe")
set(AC_EXEC_NAME "assignment-client.exe")
Expand Down
68 changes: 0 additions & 68 deletions domain-server/src/DomainServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3813,72 +3813,4 @@ void DomainServer::processAvatarZonePresencePacket(QSharedPointer<ReceivedMessag
qCWarning(domain_server) << "Ignoring null avatar presence";
return;
}
static const int SCREENSHARE_EXPIRATION_SECONDS = 24 * 60 * 60;
screensharePresence(zoneID.isNull() ? "" : zoneID.toString(), avatarID, SCREENSHARE_EXPIRATION_SECONDS);
}

void DomainServer::screensharePresence(QString roomname, QUuid avatarID, int expirationSeconds) {
if (!DependencyManager::get<AccountManager>()->hasValidAccessToken()) {
static std::once_flag presenceAuthorityWarning;
std::call_once(presenceAuthorityWarning, [] {
qCDebug(domain_server) << "No authority to send screensharePresence.";
});
return;
}

auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
auto matchingNode = limitedNodeList->nodeWithUUID(avatarID);
if (!matchingNode) {
qCWarning(domain_server) << "Ignoring avatar presence for unknown avatar ID" << avatarID;
return;
}
QString verifiedUsername = matchingNode->getPermissions().getVerifiedUserName();
if (verifiedUsername.isEmpty()) { // Silently bail for users who are not logged in.
return;
}

JSONCallbackParameters callbackParams;
callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "handleSuccessfulScreensharePresence";
callbackParams.errorCallbackMethod = "handleFailedScreensharePresence";
// Construct `callbackData`, which is data that will be available to the callback functions.
// In this case, the "success" callback needs access to the "roomname" (the zone ID) and the
// relevant avatar's UUID.
QJsonObject callbackData;
callbackData.insert("roomname", roomname);
callbackData.insert("avatarID", avatarID.toString());
callbackParams.callbackData = callbackData;
const QString PATH = "/api/v1/domains/%1/screenshare";
QString domain_id = uuidStringWithoutCurlyBraces(getID());
QJsonObject json, screenshare;
screenshare["username"] = verifiedUsername;
screenshare["roomname"] = roomname;
if (expirationSeconds > 0) {
screenshare["expiration"] = expirationSeconds;
}
json["screenshare"] = screenshare;
DependencyManager::get<AccountManager>()->sendRequest(
PATH.arg(domain_id),
AccountManagerAuth::Required,
QNetworkAccessManager::PostOperation,
callbackParams, QJsonDocument(json).toJson()
);
}

void DomainServer::handleSuccessfulScreensharePresence(QNetworkReply* requestReply, QJsonObject callbackData) {
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
if (jsonObject["status"].toString() != "success") {
qCWarning(domain_server) << "screensharePresence api call failed:" << QJsonDocument(jsonObject).toJson(QJsonDocument::Compact);
return;
}

// Tell the client that we just authorized to screenshare which zone ID in which they are authorized to screenshare.
auto nodeList = DependencyManager::get<LimitedNodeList>();
auto packet = NLPacket::create(PacketType::AvatarZonePresence, NUM_BYTES_RFC4122_UUID, true);
packet->write(QUuid(callbackData["roomname"].toString()).toRfc4122());
nodeList->sendPacket(std::move(packet), *(nodeList->nodeWithUUID(QUuid(callbackData["avatarID"].toString()))));
}

void DomainServer::handleFailedScreensharePresence(QNetworkReply* requestReply) {
qCWarning(domain_server) << "screensharePresence api call failed:" << requestReply->error();
}
5 changes: 0 additions & 5 deletions domain-server/src/DomainServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class DomainServer : public QCoreApplication, public HTTPSRequestHandler {

bool isAssetServerEnabled();

void screensharePresence(QString roomname, QUuid avatarID, int expiration_seconds = 0);

static bool forceCrashReporting() { return _forceCrashReporting; }

public slots:
Expand Down Expand Up @@ -132,9 +130,6 @@ private slots:
void handleSuccessfulICEServerAddressUpdate(QNetworkReply* requestReply);
void handleFailedICEServerAddressUpdate(QNetworkReply* requestReply);

void handleSuccessfulScreensharePresence(QNetworkReply* requestReply, QJsonObject callbackData);
void handleFailedScreensharePresence(QNetworkReply* requestReply);

void updateReplicatedNodes();
void updateDownstreamNodes();
void updateUpstreamNodes();
Expand Down
12 changes: 0 additions & 12 deletions interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ if (NOT ANDROID)
add_dependencies(${TARGET_NAME} resources)
endif()

if (SCREENSHARE)
add_dependencies(${TARGET_NAME} screenshare)
endif()

if (WIN32)
# These are external plugins, but we need to do the 'add dependency' here so that their
Expand Down Expand Up @@ -360,15 +357,6 @@ if (APPLE)
"${RESOURCES_DEV_DIR}/serverless/redirect.json"
)

if (SCREENSHARE)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
# copy screenshare app to the resource folder
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/../screenshare/hifi-screenshare-darwin-x64/hifi-screenshare.app"
"${RESOURCES_DEV_DIR}/hifi-screenshare.app"
)
endif()

if (JSDOC_ENABLED)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
# copy JSDoc files beside the executable
Expand Down
5 changes: 0 additions & 5 deletions interface/src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
#include <scripting/PlatformInfoScriptingInterface.h>
#include <scripting/RatesScriptingInterface.h>
#include <scripting/RenderScriptingInterface.h>
#include <scripting/ScreenshareScriptingInterface.h>
#include <scripting/SelectionScriptingInterface.h>
#include <scripting/SettingsScriptingInterface.h>
#include <scripting/TestScriptingInterface.h>
Expand Down Expand Up @@ -324,7 +323,6 @@ Application::~Application() {
DependencyManager::destroy<SoundCache>();
DependencyManager::destroy<OctreeStatsProvider>();
DependencyManager::destroy<GeometryCache>();
DependencyManager::destroy<ScreenshareScriptingInterface>();

if (auto resourceManager = DependencyManager::get<ResourceManager>()) {
resourceManager->cleanup();
Expand Down Expand Up @@ -541,7 +539,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptManagerPoint
scriptEngine->registerGlobalObject("AvatarList", DependencyManager::get<AvatarManager>().data());

scriptEngine->registerGlobalObject("Camera", &_myCamera);
scriptEngine->registerGlobalObject("Screenshare", DependencyManager::get<ScreenshareScriptingInterface>().data());

#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
scriptEngine->registerGlobalObject("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
Expand Down Expand Up @@ -644,8 +641,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptManagerPoint
scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());

//scriptEngine->registerGlobalObject("GooglePoly", DependencyManager::get<GooglePolyScriptingInterface>().data());

if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptManager.get(), steamClient.get()));
}
Expand Down
10 changes: 5 additions & 5 deletions interface/src/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ public slots:
// Assets
void addAssetToWorldFromURL(QString url);
void addAssetToWorldFromURLRequestFinished();
void addAssetToWorld(QString filePath, QString zipFile, bool isZip = false, bool isBlocks = false);
void addAssetToWorld(QString filePath, QString zipFile, bool isZip = false);
void addAssetToWorldUnzipFailure(QString filePath);
void addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy, bool isZip = false, bool isBlocks = false);
void addAssetToWorldUpload(QString filePath, QString mapping, bool isZip = false, bool isBlocks = false);
void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash, bool isZip = false, bool isBlocks = false);
void addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy, bool isZip = false);
void addAssetToWorldUpload(QString filePath, QString mapping, bool isZip = false);
void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash, bool isZip = false);
void addAssetToWorldAddEntity(QString filePath, QString mapping);

void handleUnzip(QString sourceFile, QStringList destinationFile, bool autoAdd, bool isZip, bool isBlocks);
void handleUnzip(QString sourceFile, QStringList destinationFile, bool autoAdd, bool isZip);

ArchiveDownloadInterface* getFileDownloadInterface() { return _fileDownload; }

Expand Down
Loading

0 comments on commit c6731d2

Please sign in to comment.