Custom Effects - Clean-ups and Enhancements (#1163)

* Cleanup EffectFileHandler

* Support Custom Effect Schemas and align EffectFileHandler

* Change back to colon prefix for system effects

* WebSockets - Fix error in handling fragmented frames

* Correct missing colon updates

* Update json with image file location for custom gif effects

* Image effect deletion - considere full filename is stored in JSON

* Correct selection lists indentions
This commit is contained in:
LordGrey
2021-02-23 20:38:54 +01:00
committed by GitHub
parent 9475b93d9f
commit 90d05e6c54
7 changed files with 486 additions and 407 deletions

View File

@@ -85,6 +85,17 @@ void WebSocketClient::handleWebSocketFrame()
case OPCODE::BINARY:
case OPCODE::TEXT:
{
// A fragmented message consists of a single frame with the FIN bit
// clear and an opcode other than 0, followed by zero or more frames
// with the FIN bit clear and the opcode set to 0, and terminated by
// a single frame with the FIN bit set and an opcode of 0.
//
// Store frame type given by first frame
if (_wsh.opCode != OPCODE::CONTINUATION )
{
_frameOpCode = _wsh.opCode;
}
// check for protocol violations
if (_onContinuation && !isContinuation)
{
@@ -117,15 +128,15 @@ void WebSocketClient::handleWebSocketFrame()
if (_wsh.fin)
{
_onContinuation = false;
if (_wsh.opCode == OPCODE::TEXT)
{
if (_frameOpCode == OPCODE::TEXT)
{
_jsonAPI->handleMessage(QString(_wsReceiveBuffer));
}
else
{
handleBinaryMessage(_wsReceiveBuffer);
}
}
else
{
handleBinaryMessage(_wsReceiveBuffer);
}
_wsReceiveBuffer.clear();
}

View File

@@ -52,6 +52,9 @@ private:
// websocket header store
WebSocketHeader _wsh;
//opCode of first frame (in case of fragmented frames)
quint8 _frameOpCode;
// masks for fields in the basic header
static uint8_t const BHB0_OPCODE = 0x0F;
static uint8_t const BHB0_RSV3 = 0x10;