Skip to content

Commit d01b7d0

Browse files
committed
fix: update WebSocket build flags for proper string handling and clean up unused variables
1 parent b70249a commit d01b7d0

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

.github/workflows/build-and-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ jobs:
3939
run: |
4040
cd firmware
4141
# Inject production WebSocket config via build flags
42+
# Inner \\\" produces literal \" so the C compiler sees a string literal.
4243
FLAGS=""
4344
if [ -n "$QBIT_WS_HOST" ]; then
44-
FLAGS="$FLAGS -DWS_HOST=\"$QBIT_WS_HOST\" -DWS_PORT=443"
45+
FLAGS="$FLAGS -DWS_HOST=\\\"$QBIT_WS_HOST\\\" -DWS_PORT=443"
4546
echo "Injected WS_HOST=$QBIT_WS_HOST, WS_PORT=443"
4647
fi
4748
if [ -n "$QBIT_WS_API_KEY" ]; then
48-
FLAGS="$FLAGS -DWS_API_KEY=\"$QBIT_WS_API_KEY\""
49+
FLAGS="$FLAGS -DWS_API_KEY=\\\"$QBIT_WS_API_KEY\\\""
4950
echo "Injected WS_API_KEY (hidden)"
5051
fi
5152
export PLATFORMIO_BUILD_FLAGS="$FLAGS"

firmware/src/main.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ static const char BOOT_MELODY[] =
106106
using namespace websockets;
107107
static WebsocketsClient _wsClient;
108108
static bool _wsConnected = false;
109-
static String _wsUrl;
110109
static unsigned long _wsLastReconnect = 0;
111110

112111
// ==========================================================================
@@ -988,8 +987,6 @@ static void wsSendClaimReject() {
988987
// ArduinoWebsockets library to support setInsecure() on ESP32 and increase
989988
// the header-read timeout for Cloudflare's large response headers.
990989
static bool wsConnect() {
991-
if (_wsUrl.length() == 0) return false;
992-
993990
// Close any existing connection
994991
if (_wsClient.available()) {
995992
_wsClient.close();
@@ -1214,7 +1211,6 @@ void setup() {
12141211
_wsClient.onEvent(wsEvent);
12151212
_wsClient.onMessage(wsMessage);
12161213

1217-
_wsUrl = String(WS_PORT == 443 ? "wss://" : "ws://") + WS_HOST + WS_PATH;
12181214
_wsLastReconnect = 0;
12191215
wsConnect();
12201216

tools/simulate-devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def main():
144144

145145
for i in range(args.count):
146146
t = threading.Thread(target=device_thread,
147-
args=(i, url, stop_event, args.auto_claim, args.key),
147+
args=(i, url, stop_event, args.auto_claim, args.key),
148148
daemon=True)
149149
t.start()
150150
threads.append(t)

0 commit comments

Comments
 (0)