mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
import more changes from master
This commit is contained in:
parent
16bc68f2f9
commit
7e6b53311d
@ -20,6 +20,7 @@ echo "[obs-websocket] Building 'obs-websocket' for macOS."
|
|||||||
mkdir -p build && cd build
|
mkdir -p build && cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DQTDIR=/usr/local/opt/qt \
|
-DQTDIR=/usr/local/opt/qt \
|
||||||
|
-DBOOST_ROOT=/usr/local/opt/boost \
|
||||||
-DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \
|
-DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \
|
||||||
-DLIBOBS_LIB=../../obs-studio/libobs \
|
-DLIBOBS_LIB=../../obs-studio/libobs \
|
||||||
-DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \
|
-DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \
|
||||||
|
@ -15,7 +15,7 @@ if git diff --quiet; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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."
|
echo "-- Skipping documentation deployment because this is either a pull request or a non-master branch."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -11,7 +11,8 @@ apt-get install -y \
|
|||||||
checkinstall \
|
checkinstall \
|
||||||
cmake \
|
cmake \
|
||||||
obs-studio \
|
obs-studio \
|
||||||
libqt5websockets5-dev
|
qtbase5-dev \
|
||||||
|
libboost-all-dev
|
||||||
|
|
||||||
# Dirty hack
|
# 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
|
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
|
||||||
|
@ -12,123 +12,6 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>CHILDREN</key>
|
<key>CHILDREN</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../build/QtNetwork</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>292</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../build/QtWebSockets</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>292</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>bin</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>509</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>2</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>Resources</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>509</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>2</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>Contents</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>509</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>2</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>OBS.app</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>509</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>2</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>Applications</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>509</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>CHILDREN</key>
|
<key>CHILDREN</key>
|
||||||
<array>
|
<array>
|
||||||
@ -635,7 +518,7 @@
|
|||||||
<key>OVERWRITE_PERMISSIONS</key>
|
<key>OVERWRITE_PERMISSIONS</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>VERSION</key>
|
<key>VERSION</key>
|
||||||
<string>4.5.0</string>
|
<string>5.0.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>PROJECT_COMMENTS</key>
|
<key>PROJECT_COMMENTS</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -12,9 +12,6 @@ fi
|
|||||||
echo "[obs-websocket] Preparing package build"
|
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 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 GIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
export VERSION="$GIT_HASH-$TRAVIS_BRANCH"
|
export VERSION="$GIT_HASH-$TRAVIS_BRANCH"
|
||||||
@ -27,46 +24,17 @@ fi
|
|||||||
export FILENAME="obs-websocket-$VERSION.pkg"
|
export FILENAME="obs-websocket-$VERSION.pkg"
|
||||||
export LATEST_FILENAME="obs-websocket-latest-$LATEST_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"
|
echo "[obs-websocket] Modifying obs-websocket.so"
|
||||||
install_name_tool \
|
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/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/QtGui.framework/Versions/5/QtGui @rpath/QtGui \
|
||||||
-change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \
|
-change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \
|
||||||
./build/obs-websocket.so
|
./build/obs-websocket.so
|
||||||
|
|
||||||
# Check if replacement worked
|
# 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"
|
echo "[obs-websocket] Dependencies for obs-websocket"
|
||||||
otool -L ./build/obs-websocket.so
|
otool -L ./build/obs-websocket.so
|
||||||
|
|
||||||
chmod -w ./build/QtWebSockets ./build/QtNetwork
|
|
||||||
|
|
||||||
echo "[obs-websocket] Actual package build"
|
echo "[obs-websocket] Actual package build"
|
||||||
packagesbuild ./CI/macos/obs-websocket.pkgproj
|
packagesbuild ./CI/macos/obs-websocket.pkgproj
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ PAGER=cat checkinstall -y --type=debian --fstrans=no --nodoc \
|
|||||||
--backup=no --deldoc=yes --install=no \
|
--backup=no --deldoc=yes --install=no \
|
||||||
--pkgname=obs-websocket --pkgversion="$PKG_VERSION" \
|
--pkgname=obs-websocket --pkgversion="$PKG_VERSION" \
|
||||||
--pkglicense="GPLv2.0" --maintainer="contact@slepin.fr" \
|
--pkglicense="GPLv2.0" --maintainer="contact@slepin.fr" \
|
||||||
--requires="libqt5websockets5" --pkggroup="video" \
|
--pkggroup="video" \
|
||||||
--pkgsource="https://github.com/Palakis/obs-websocket" \
|
--pkgsource="https://github.com/Palakis/obs-websocket" \
|
||||||
--pakdir="/package"
|
--pakdir="/package"
|
||||||
|
|
||||||
|
@ -376,15 +376,6 @@ void Utils::SysTrayNotify(QString &text,
|
|||||||
trayIcon->showMessage(title, text, icon);
|
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() {
|
const char* Utils::GetRecordingFolder() {
|
||||||
config_t* profile = obs_frontend_get_profile_config();
|
config_t* profile = obs_frontend_get_profile_config();
|
||||||
QString outputMode = config_get_string(profile, "Output", "Mode");
|
QString outputMode = config_get_string(profile, "Output", "Mode");
|
||||||
|
@ -26,7 +26,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QHostAddress>
|
|
||||||
|
|
||||||
#include <obs.hpp>
|
#include <obs.hpp>
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
@ -70,8 +69,6 @@ class Utils {
|
|||||||
QSystemTrayIcon::MessageIcon n,
|
QSystemTrayIcon::MessageIcon n,
|
||||||
QString title = QString("obs-websocket"));
|
QString title = QString("obs-websocket"));
|
||||||
|
|
||||||
static QString FormatIPAddress(QHostAddress &addr);
|
|
||||||
|
|
||||||
static const char* GetRecordingFolder();
|
static const char* GetRecordingFolder();
|
||||||
static bool SetRecordingFolder(const char* path);
|
static bool SetRecordingFolder(const char* path);
|
||||||
|
|
||||||
|
@ -128,11 +128,10 @@ QSet<QString> WSRequestHandler::authNotRequired {
|
|||||||
"Authenticate"
|
"Authenticate"
|
||||||
};
|
};
|
||||||
|
|
||||||
WSRequestHandler::WSRequestHandler(QWebSocket* client) :
|
WSRequestHandler::WSRequestHandler() :
|
||||||
_messageId(0),
|
_messageId(0),
|
||||||
_requestType(""),
|
_requestType(""),
|
||||||
data(nullptr),
|
data(nullptr)
|
||||||
_client(client)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,13 +163,13 @@ void WSRequestHandler::processIncomingMessage(QString textMessage) {
|
|||||||
_requestType = obs_data_get_string(data, "request-type");
|
_requestType = obs_data_get_string(data, "request-type");
|
||||||
_messageId = obs_data_get_string(data, "message-id");
|
_messageId = obs_data_get_string(data, "message-id");
|
||||||
|
|
||||||
if (Config::Current()->AuthRequired
|
// if (Config::Current()->AuthRequired
|
||||||
&& (_client->property(PROP_AUTHENTICATED).toBool() == false)
|
// && (_client->property(PROP_AUTHENTICATED).toBool() == false)
|
||||||
&& (authNotRequired.find(_requestType) == authNotRequired.end()))
|
// && (authNotRequired.find(_requestType) == authNotRequired.end()))
|
||||||
{
|
// {
|
||||||
SendErrorResponse("Not Authenticated");
|
// SendErrorResponse("Not Authenticated");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void (*handlerFunc)(WSRequestHandler*) = (messageMap[_requestType]);
|
void (*handlerFunc)(WSRequestHandler*) = (messageMap[_requestType]);
|
||||||
|
|
||||||
@ -215,8 +214,8 @@ void WSRequestHandler::SendErrorResponse(obs_data_t* additionalFields) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WSRequestHandler::SendResponse(obs_data_t* response) {
|
void WSRequestHandler::SendResponse(obs_data_t* response) {
|
||||||
QString json = obs_data_get_json(response);
|
assert(_response.isNull());
|
||||||
_client->sendTextMessage(json);
|
_response = obs_data_get_json(response);
|
||||||
|
|
||||||
if (Config::Current()->DebugEnabled)
|
if (Config::Current()->DebugEnabled)
|
||||||
blog(LOG_DEBUG, "Response << '%s'", json.toUtf8().constData());
|
blog(LOG_DEBUG, "Response << '%s'", json.toUtf8().constData());
|
||||||
|
@ -22,8 +22,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QWebSocket>
|
|
||||||
#include <QWebSocketServer>
|
|
||||||
|
|
||||||
#include <obs.hpp>
|
#include <obs.hpp>
|
||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
@ -34,15 +32,18 @@ class WSRequestHandler : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WSRequestHandler(QWebSocket* client);
|
explicit WSRequestHandler();
|
||||||
~WSRequestHandler();
|
~WSRequestHandler();
|
||||||
void processIncomingMessage(QString textMessage);
|
void processIncomingMessage(QString textMessage);
|
||||||
bool hasField(QString name);
|
bool hasField(QString name);
|
||||||
|
QString getResponse() {
|
||||||
|
return _response;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWebSocket* _client;
|
|
||||||
const char* _messageId;
|
const char* _messageId;
|
||||||
const char* _requestType;
|
const char* _requestType;
|
||||||
|
QString _response;
|
||||||
OBSDataAutoRelease data;
|
OBSDataAutoRelease data;
|
||||||
|
|
||||||
void SendOKResponse(obs_data_t* additionalFields = NULL);
|
void SendOKResponse(obs_data_t* additionalFields = NULL);
|
||||||
|
@ -91,14 +91,14 @@ void WSRequestHandler::HandleAuthenticate(WSRequestHandler* req) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((req->_client->property(PROP_AUTHENTICATED).toBool() == false)
|
// if ((req->_client->property(PROP_AUTHENTICATED).toBool() == false)
|
||||||
&& Config::Current()->CheckAuth(auth))
|
// && Config::Current()->CheckAuth(auth))
|
||||||
{
|
// {
|
||||||
req->_client->setProperty(PROP_AUTHENTICATED, true);
|
// req->_client->setProperty(PROP_AUTHENTICATED, true);
|
||||||
req->SendOKResponse();
|
// req->SendOKResponse();
|
||||||
} else {
|
// } else {
|
||||||
req->SendErrorResponse("Authentication Failed.");
|
// req->SendErrorResponse("Authentication Failed.");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user