diff --git a/CI/build-macos.sh b/CI/build-macos.sh index f528ce2e..c41ebaf6 100755 --- a/CI/build-macos.sh +++ b/CI/build-macos.sh @@ -20,6 +20,7 @@ echo "[obs-websocket] Building 'obs-websocket' for macOS." mkdir -p build && cd build cmake .. \ -DQTDIR=/usr/local/opt/qt \ + -DBOOST_ROOT=/usr/local/opt/boost \ -DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \ -DLIBOBS_LIB=../../obs-studio/libobs \ -DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \ diff --git a/CI/generate-docs.sh b/CI/generate-docs.sh index 5e7d6d01..34350520 100755 --- a/CI/generate-docs.sh +++ b/CI/generate-docs.sh @@ -15,7 +15,7 @@ if git diff --quiet; then exit 0 fi -if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "4.x-current" ]; then +if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then echo "-- Skipping documentation deployment because this is either a pull request or a non-master branch." exit 0 fi diff --git a/CI/install-dependencies-xenial.sh b/CI/install-dependencies-xenial.sh index b6dda1c6..4b4041bd 100755 --- a/CI/install-dependencies-xenial.sh +++ b/CI/install-dependencies-xenial.sh @@ -11,7 +11,8 @@ apt-get install -y \ checkinstall \ cmake \ obs-studio \ - libqt5websockets5-dev + qtbase5-dev \ + libboost-all-dev # Dirty hack wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/master/UI/obs-frontend-api/obs-frontend-api.h diff --git a/CI/macos/obs-websocket.pkgproj b/CI/macos/obs-websocket.pkgproj index b8159920..1006aa7d 100644 --- a/CI/macos/obs-websocket.pkgproj +++ b/CI/macos/obs-websocket.pkgproj @@ -12,123 +12,6 @@ CHILDREN - - CHILDREN - - - CHILDREN - - - CHILDREN - - - CHILDREN - - - CHILDREN - - - CHILDREN - - GID - 80 - PATH - ../../build/QtNetwork - PATH_TYPE - 1 - PERMISSIONS - 292 - TYPE - 3 - UID - 0 - - - CHILDREN - - GID - 80 - PATH - ../../build/QtWebSockets - PATH_TYPE - 1 - PERMISSIONS - 292 - TYPE - 3 - UID - 0 - - - GID - 80 - PATH - bin - PATH_TYPE - 0 - PERMISSIONS - 509 - TYPE - 2 - UID - 0 - - - GID - 80 - PATH - Resources - PATH_TYPE - 0 - PERMISSIONS - 509 - TYPE - 2 - UID - 0 - - - GID - 80 - PATH - Contents - PATH_TYPE - 0 - PERMISSIONS - 509 - TYPE - 2 - UID - 0 - - - GID - 80 - PATH - OBS.app - PATH_TYPE - 0 - PERMISSIONS - 509 - TYPE - 2 - UID - 0 - - - GID - 80 - PATH - Applications - PATH_TYPE - 0 - PERMISSIONS - 509 - TYPE - 1 - UID - 0 - CHILDREN @@ -635,7 +518,7 @@ OVERWRITE_PERMISSIONS VERSION - 4.5.0 + 5.0.0 PROJECT_COMMENTS diff --git a/CI/package-macos.sh b/CI/package-macos.sh index 62bfb622..7fc2e59b 100755 --- a/CI/package-macos.sh +++ b/CI/package-macos.sh @@ -12,9 +12,6 @@ fi echo "[obs-websocket] Preparing package build" export QT_CELLAR_PREFIX="$(/usr/bin/find /usr/local/Cellar/qt -d 1 | sort -t '.' -k 1,1n -k 2,2n -k 3,3n | tail -n 1)" -export WS_LIB="/usr/local/opt/qt/lib/QtWebSockets.framework/QtWebSockets" -export NET_LIB="/usr/local/opt/qt/lib/QtNetwork.framework/QtNetwork" - export GIT_HASH=$(git rev-parse --short HEAD) export VERSION="$GIT_HASH-$TRAVIS_BRANCH" @@ -27,46 +24,17 @@ fi export FILENAME="obs-websocket-$VERSION.pkg" export LATEST_FILENAME="obs-websocket-latest-$LATEST_VERSION.pkg" -echo "[obs-websocket] Copying Qt dependencies" -if [ ! -f ./build/$(basename $WS_LIB) ]; then cp $WS_LIB ./build; fi -if [ ! -f ./build/$(basename $NET_LIB) ]; then cp $NET_LIB ./build; fi - -chmod +rw ./build/QtWebSockets ./build/QtNetwork - -echo "[obs-websocket] Modifying QtNetwork" -install_name_tool \ - -id @rpath/QtNetwork \ - -change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \ - -change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \ - ./build/QtNetwork - -echo "[obs-websocket] Modifying QtWebSockets" -install_name_tool \ - -id @rpath/QtWebSockets \ - -change /usr/local/opt/qt/lib/QtWebSockets.framework/Versions/5/QtWebSockets @rpath/QtWebSockets \ - -change $QT_CELLAR_PREFIX/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \ - -change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \ - ./build/QtWebSockets - echo "[obs-websocket] Modifying obs-websocket.so" install_name_tool \ - -change /usr/local/opt/qt/lib/QtWebSockets.framework/Versions/5/QtWebSockets @rpath/QtWebSockets \ -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @rpath/QtWidgets \ - -change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \ -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @rpath/QtGui \ -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \ ./build/obs-websocket.so # Check if replacement worked -echo "[obs-websocket] Dependencies for QtNetwork" -otool -L ./build/QtNetwork -echo "[obs-websocket] Dependencies for QtWebSockets" -otool -L ./build/QtWebSockets echo "[obs-websocket] Dependencies for obs-websocket" otool -L ./build/obs-websocket.so -chmod -w ./build/QtWebSockets ./build/QtNetwork - echo "[obs-websocket] Actual package build" packagesbuild ./CI/macos/obs-websocket.pkgproj diff --git a/CI/package-xenial.sh b/CI/package-xenial.sh index b1dda473..dde64929 100755 --- a/CI/package-xenial.sh +++ b/CI/package-xenial.sh @@ -17,7 +17,7 @@ PAGER=cat checkinstall -y --type=debian --fstrans=no --nodoc \ --backup=no --deldoc=yes --install=no \ --pkgname=obs-websocket --pkgversion="$PKG_VERSION" \ --pkglicense="GPLv2.0" --maintainer="contact@slepin.fr" \ - --requires="libqt5websockets5" --pkggroup="video" \ + --pkggroup="video" \ --pkgsource="https://github.com/Palakis/obs-websocket" \ --pakdir="/package" diff --git a/src/Utils.cpp b/src/Utils.cpp index b73ed51c..570e676d 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -376,15 +376,6 @@ void Utils::SysTrayNotify(QString &text, trayIcon->showMessage(title, text, icon); } -QString Utils::FormatIPAddress(QHostAddress &addr) { - QRegExp v4regex("(::ffff:)(((\\d).){3})", Qt::CaseInsensitive); - QString addrString = addr.toString(); - if (addrString.contains(v4regex)) { - addrString = QHostAddress(addr.toIPv4Address()).toString(); - } - return addrString; -} - const char* Utils::GetRecordingFolder() { config_t* profile = obs_frontend_get_profile_config(); QString outputMode = config_get_string(profile, "Output", "Mode"); diff --git a/src/Utils.h b/src/Utils.h index ba97d5cf..651991d6 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -26,7 +26,6 @@ with this program. If not, see #include #include #include -#include #include #include @@ -70,8 +69,6 @@ class Utils { QSystemTrayIcon::MessageIcon n, QString title = QString("obs-websocket")); - static QString FormatIPAddress(QHostAddress &addr); - static const char* GetRecordingFolder(); static bool SetRecordingFolder(const char* path); diff --git a/src/WSRequestHandler.cpp b/src/WSRequestHandler.cpp index 321fa5a6..0b859b1a 100644 --- a/src/WSRequestHandler.cpp +++ b/src/WSRequestHandler.cpp @@ -128,11 +128,10 @@ QSet WSRequestHandler::authNotRequired { "Authenticate" }; -WSRequestHandler::WSRequestHandler(QWebSocket* client) : +WSRequestHandler::WSRequestHandler() : _messageId(0), _requestType(""), - data(nullptr), - _client(client) + data(nullptr) { } @@ -164,13 +163,13 @@ void WSRequestHandler::processIncomingMessage(QString textMessage) { _requestType = obs_data_get_string(data, "request-type"); _messageId = obs_data_get_string(data, "message-id"); - if (Config::Current()->AuthRequired - && (_client->property(PROP_AUTHENTICATED).toBool() == false) - && (authNotRequired.find(_requestType) == authNotRequired.end())) - { - SendErrorResponse("Not Authenticated"); - return; - } + // if (Config::Current()->AuthRequired + // && (_client->property(PROP_AUTHENTICATED).toBool() == false) + // && (authNotRequired.find(_requestType) == authNotRequired.end())) + // { + // SendErrorResponse("Not Authenticated"); + // return; + // } void (*handlerFunc)(WSRequestHandler*) = (messageMap[_requestType]); @@ -215,8 +214,8 @@ void WSRequestHandler::SendErrorResponse(obs_data_t* additionalFields) { } void WSRequestHandler::SendResponse(obs_data_t* response) { - QString json = obs_data_get_json(response); - _client->sendTextMessage(json); + assert(_response.isNull()); + _response = obs_data_get_json(response); if (Config::Current()->DebugEnabled) blog(LOG_DEBUG, "Response << '%s'", json.toUtf8().constData()); diff --git a/src/WSRequestHandler.h b/src/WSRequestHandler.h index cb259827..be109009 100644 --- a/src/WSRequestHandler.h +++ b/src/WSRequestHandler.h @@ -22,8 +22,6 @@ with this program. If not, see #include #include -#include -#include #include #include @@ -34,15 +32,18 @@ class WSRequestHandler : public QObject { Q_OBJECT public: - explicit WSRequestHandler(QWebSocket* client); + explicit WSRequestHandler(); ~WSRequestHandler(); void processIncomingMessage(QString textMessage); bool hasField(QString name); + QString getResponse() { + return _response; + } private: - QWebSocket* _client; const char* _messageId; const char* _requestType; + QString _response; OBSDataAutoRelease data; void SendOKResponse(obs_data_t* additionalFields = NULL); diff --git a/src/WSRequestHandler_General.cpp b/src/WSRequestHandler_General.cpp index 6e98e519..efe0b9db 100644 --- a/src/WSRequestHandler_General.cpp +++ b/src/WSRequestHandler_General.cpp @@ -91,14 +91,14 @@ void WSRequestHandler::HandleAuthenticate(WSRequestHandler* req) { return; } - if ((req->_client->property(PROP_AUTHENTICATED).toBool() == false) - && Config::Current()->CheckAuth(auth)) - { - req->_client->setProperty(PROP_AUTHENTICATED, true); - req->SendOKResponse(); - } else { - req->SendErrorResponse("Authentication Failed."); - } + // if ((req->_client->property(PROP_AUTHENTICATED).toBool() == false) + // && Config::Current()->CheckAuth(auth)) + // { + // req->_client->setProperty(PROP_AUTHENTICATED, true); + // req->SendOKResponse(); + // } else { + // req->SendErrorResponse("Authentication Failed."); + // } } /**