diff --git a/cmake/externals/polyvox/CMakeLists.txt b/cmake/externals/polyvox/CMakeLists.txt index a92c07da86..e5c3521b63 100644 --- a/cmake/externals/polyvox/CMakeLists.txt +++ b/cmake/externals/polyvox/CMakeLists.txt @@ -1,11 +1,15 @@ set(EXTERNAL_NAME polyvox) include(ExternalProject) + +message(STATUS "===== POLYVOX BUILD_TYPE ${BUILD_TYPE} ${CMAKE_BUILD_TYPE}") +set(CMAKE_BUILD_TYPE Release) + ExternalProject_Add( ${EXTERNAL_NAME} URL https://public.highfidelity.com/dependencies/polyvox-master-2015-7-15.zip URL_MD5 9ec6323b87e849ae36e562ae1c7494a9 - CMAKE_ARGS -DENABLE_EXAMPLES=OFF -DENABLE_BINDINGS=OFF -DCMAKE_INSTALL_PREFIX:PATH= + CMAKE_ARGS -DENABLE_EXAMPLES=OFF -DENABLE_BINDINGS=OFF -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build LOG_DOWNLOAD 1 LOG_CONFIGURE 1 diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index bb8ebbd2a0..bf152ba5d8 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -15,9 +15,9 @@ set(CUSTOM_INTERFACE_QRC_PATHS "") find_npm() -if (BUILD_TOOLS AND NPM_EXECUTABLE) - add_custom_qrc_path(CUSTOM_INTERFACE_QRC_PATHS "${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json" "auto-complete/hifiJSDoc.json") -endif () +#if (BUILD_TOOLS AND NPM_EXECUTABLE) +# add_custom_qrc_path(CUSTOM_INTERFACE_QRC_PATHS "${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json" "auto-complete/hifiJSDoc.json") +#endif () set(RESOURCES_QRC ${CMAKE_CURRENT_BINARY_DIR}/resources.qrc) set(RESOURCES_RCC ${CMAKE_CURRENT_SOURCE_DIR}/compiledResources/resources.rcc) @@ -156,7 +156,9 @@ elseif (WIN32) configure_file("${HF_CMAKE_DIR}/templates/VersionInfo.rc.in" ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) # add an executable that also has the icon itself and the configured rc file as resources - add_executable(${TARGET_NAME} WIN32 ${INTERFACE_SRCS} ${QM} ${CONFIGURE_ICON_RC_OUTPUT} ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) + #add_executable(${TARGET_NAME} WIN32 ${INTERFACE_SRCS} ${QM} ${CONFIGURE_ICON_RC_OUTPUT} ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) + ##^^^^^ creates native Win32 app w/o cmd console vvvvvv forces cmd console for logging + add_executable(${TARGET_NAME} ${INTERFACE_SRCS} ${QM} ${CONFIGURE_ICON_RC_OUTPUT} ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) if (NOT DEV_BUILD) add_custom_command( @@ -175,10 +177,10 @@ else () endif () -if (BUILD_TOOLS AND NPM_EXECUTABLE) +#if (BUILD_TOOLS AND NPM_EXECUTABLE) # require JSDoc to be build before interface is deployed - add_dependencies(resources jsdoc) -endif() +# add_dependencies(resources jsdoc) +#endif() add_dependencies(${TARGET_NAME} resources) @@ -318,9 +320,9 @@ if (APPLE) "${CMAKE_SOURCE_DIR}/scripts" "${RESOURCES_DEV_DIR}/scripts" # copy JSDoc files beside the executable - COMMAND "${CMAKE_COMMAND}" -E copy_directory - "${CMAKE_SOURCE_DIR}/tools/jsdoc/out" - "${RESOURCES_DEV_DIR}/jsdoc" + #COMMAND "${CMAKE_COMMAND}" -E copy_directory + # "${CMAKE_SOURCE_DIR}/tools/jsdoc/out" + # "${RESOURCES_DEV_DIR}/jsdoc" # copy the resources files beside the executable COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${RESOURCES_RCC}" @@ -373,9 +375,9 @@ else() "${PROJECT_SOURCE_DIR}/resources/serverless/redirect.json" "${RESOURCES_DEV_DIR}/serverless/redirect.json" # copy JSDoc files beside the executable - COMMAND "${CMAKE_COMMAND}" -E copy_directory - "${CMAKE_SOURCE_DIR}/tools/jsdoc/out" - "${INTERFACE_EXEC_DIR}/jsdoc" + #COMMAND "${CMAKE_COMMAND}" -E copy_directory + # "${CMAKE_SOURCE_DIR}/tools/jsdoc/out" + # "${INTERFACE_EXEC_DIR}/jsdoc" ) # link target to external libraries diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ba28eb6068..daf8d0a77c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2767,14 +2767,14 @@ Application::~Application() { avatarManager->handleProcessedPhysicsTransaction(transaction); avatarManager->deleteAllAvatars(); - + auto myCharacterController = getMyAvatar()->getCharacterController(); myCharacterController->clearDetailedMotionStates(); - + myCharacterController->buildPhysicsTransaction(transaction); _physicsEngine->processTransaction(transaction); myCharacterController->handleProcessedPhysicsTransaction(transaction); - + _physicsEngine->setCharacterController(nullptr); // the _shapeManager should have zero references @@ -6978,7 +6978,7 @@ void Application::updateWindowTitle() const { auto accountManager = DependencyManager::get(); auto isInErrorState = nodeList->getDomainHandler().isInErrorState(); - QString buildVersion = " - " + QString buildVersion = " - Kasen v0.81.1 - " + (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build")) + " " + applicationVersion(); diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index c537fea646..8979b5a8a6 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1915,7 +1915,7 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo outputDeviceI int deviceChannelCount = _outputFormat.channelCount(); int frameSize = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * deviceChannelCount * _outputFormat.sampleRate()) / _desiredOutputFormat.sampleRate(); int requestedSize = _sessionOutputBufferSizeFrames * frameSize * AudioConstants::SAMPLE_SIZE; - _audioOutput->setBufferSize(requestedSize); + _audioOutput->setBufferSize(requestedSize * 16); // initialize mix buffers on the _audioOutput thread to avoid races connect(_audioOutput, &QAudioOutput::stateChanged, [&, frameSize, requestedSize](QAudio::State state) { diff --git a/libraries/networking/src/UserActivityLogger.cpp b/libraries/networking/src/UserActivityLogger.cpp index 948acd3d78..7315824136 100644 --- a/libraries/networking/src/UserActivityLogger.cpp +++ b/libraries/networking/src/UserActivityLogger.cpp @@ -35,6 +35,8 @@ void UserActivityLogger::disable(bool disable) { } void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) { + qCDebug(networking).nospace() << ">>> UserActivityLogger::logAction(" << action << "," << QJsonDocument(details).toJson(); + return; if (_disabled.get()) { return; } diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 7abb63ca1c..3d01ea5a82 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -252,7 +252,7 @@ QString ScriptEngine::getContext() const { return "unknown"; } -bool ScriptEngine::isDebugMode() const { +bool ScriptEngine::isDebugMode() const { #if defined(DEBUG) return true; #else @@ -769,6 +769,11 @@ void ScriptEngine::init() { #if DEV_BUILD || PR_BUILD registerGlobalObject("StackTest", new StackTestScriptingInterface(this)); #endif + + globalObject().setProperty("KALILA", "isWaifu"); + globalObject().setProperty("Kute", newFunction([](QScriptContext* context, QScriptEngine* engine) -> QScriptValue { + return context->argument(0).toString().toLower() == "kalila" ? true : false; + })); } void ScriptEngine::registerValue(const QString& valueName, QScriptValue value) { @@ -2252,6 +2257,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co BaseScriptEngine sandbox; sandbox.setProcessEventsInterval(SANDBOX_TIMEOUT); QScriptValue testConstructor, exception; + if (atoi(getenv("UNSAFE_ENTITY_SCRIPTS") ? getenv("UNSAFE_ENTITY_SCRIPTS") : "0")) { QTimer timeout; timeout.setSingleShot(true); @@ -2274,13 +2280,57 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co exception = testConstructor; } } + else { + // IF YOU FUCK UP, DELETE FROM HERE TO... + QList safeURLS = { "https://animedeck.com/", "http://animedeck.com/" }; + safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); + + bool isInWhitelist = false; // assume unsafe + for (const auto& str : safeURLS) { + // qDebug() << "CHECKING" << entityID.toString() << scriptOrURL << "AGAINST" << str; + qDebug() << "SCRIPTOURL STARTSWITH" << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" + << scriptOrURL.startsWith(str); + if (scriptOrURL.startsWith(str)) { + isInWhitelist = true; + break; // bail early since we found a match + } + } + if (!isInWhitelist) { + qDebug() << "(disabled entity script)" << entityID.toString() << scriptOrURL; + exception = makeError("UNSAFE_ENTITY_SCRIPTS == 0"); + } else { + QTimer timeout; + timeout.setSingleShot(true); + timeout.start(SANDBOX_TIMEOUT); + connect(&timeout, &QTimer::timeout, [=, &sandbox] { + qCDebug(scriptengine) << "ScriptEngine::entityScriptContentAvailable timeout"; + + // Guard against infinite loops and non-performant code + sandbox.raiseException( + sandbox.makeError(QString("Timed out (entity constructors are limited to %1ms)").arg(SANDBOX_TIMEOUT))); + }); + + testConstructor = sandbox.evaluate(program); + + if (sandbox.hasUncaughtException()) { + exception = sandbox.cloneUncaughtException(QString("(preflight %1)").arg(entityID.toString())); + sandbox.clearExceptions(); + } else if (testConstructor.isError()) { + exception = testConstructor; + } + } + // DELETE UP TO HERE, THEN UNCOMMENT BELOW. + + // qDebug() << "(disabled entity script)" << entityID.toString() << scriptOrURL; + // exception = makeError("UNSAFE_ENTITY_SCRIPTS == 0"); + } if (exception.isError()) { - // create a local copy using makeError to decouple from the sandbox engine - exception = makeError(exception); - setError(formatException(exception, _enableExtendedJSExceptions.get()), EntityScriptStatus::ERROR_RUNNING_SCRIPT); - emit unhandledException(exception); - return; + // create a local copy using makeError to decouple from the sandbox engine + exception = makeError(exception); + setError(formatException(exception, _enableExtendedJSExceptions.get()), EntityScriptStatus::ERROR_RUNNING_SCRIPT); + emit unhandledException(exception); + return; } // CONSTRUCTOR VIABILITY @@ -2648,4 +2698,3 @@ void ScriptEngine::callEntityScriptMethod(const EntityItemID& entityID, const QS } } } - diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4a0f52e272..8a0ccb07c1 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -9,23 +9,23 @@ # add the plugin directories file(GLOB PLUGIN_SUBDIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*") list(REMOVE_ITEM PLUGIN_SUBDIRS "CMakeFiles") - +set(CMAKE_BUILD_TYPE "Release") # client-side plugins if (NOT SERVER_ONLY AND NOT ANDROID) - set(DIR "oculus") - add_subdirectory(${DIR}) + #set(DIR "oculus") + #add_subdirectory(${DIR}) set(DIR "hifiSdl2") add_subdirectory(${DIR}) set(DIR "openvr") add_subdirectory(${DIR}) - set(DIR "oculusLegacy") - add_subdirectory(${DIR}) + #set(DIR "oculusLegacy") + #add_subdirectory(${DIR}) if (USE_SIXENSE) set(DIR "hifiSixense") add_subdirectory(${DIR}) endif() - + set(DIR "hifiSpacemouse") add_subdirectory(${DIR}) set(DIR "hifiNeuron")